akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cmath>
#include <cstdio>
#include <algorithm>
#include <random>
#include <string>
#include <bitset>
#include <map>
#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <set>
#include <cstring>
#include <cstdlib>
#include <cctype>

#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define FORR(i, m, n) for(int i = m; i >= n; i--)
#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)
#define INF 999999999

using namespace std;

typedef pair<int, int> P;
typedef pair<llong, llong> LP;
typedef pair<int, P> PP;
typedef pair<llong, LP> LPP;

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


llong pow(int x, int n){
    llong ans = x;
    if (n == 0) return 1;

    for(int i = 0; i < n - 1; i++) {
        ans *= x;
    }

    return ans;
}


void swap(int *X, int *Y){
    int t = *X; *X = *Y; *Y = t;
}


string toUpper(string s) {
    string t = s;
    REP(i, s.size()) {
        t[i] = toupper(s[i]);
    }
    return t;
}


string toLower(string s) {
    string t = s;
    REP(i, s.size()) {
        t[i] = tolower(s[i]);
    }
    return t;
}

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

    if(a % b == 0) {
        cout << 0 << endl;
    } else {
        cout << 1 << endl;
    }

    return 0;
}

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

int main(void) {
	int kazu[9][9];
	int dame[9][9];
	int maxdatanum;
	int datanum;
	int x,y;
	int xx,yy;
	scanf("%d",&maxdatanum);
	for(datanum=0;datanum<maxdatanum;datanum++) {
		if(datanum)puts("");
		for(y=0;y<9;y++) {
			for(x=0;x<9;x++) {
				scanf("%d",&kazu[x][y]);
			}
		}
		memset(dame,0,sizeof(dame));
		for(y=0;y<9;y++) {
			for(x=0;x<9;x++) {
				if(dame[x][y])continue;
				for(xx=0;xx<9;xx++) {
					if(xx==x)continue;
					if(kazu[x][y]==kazu[xx][y]) {
						dame[x][y]=1;
						dame[xx][y]=1;
					}
				}
				if(dame[x][y])continue;
				for(yy=0;yy<9;yy++) {
					if(yy==y)continue;
					if(kazu[x][y]==kazu[x][yy]) {
						dame[x][y]=1;
						dame[x][yy]=1;
					}
				}
				if(dame[x][y])continue;
				for(yy=y/3*3;yy<y/3*3+3;yy++) {
					for(xx=x/3*3;xx<x/3*3+3;xx++) {
						if(xx==x && yy==y)continue;
						if(kazu[x][y]==kazu[xx][yy]) {
							dame[x][y]=1;
							dame[xx][yy]=1;
						}
					}
				}
			}
		}
		for(y=0;y<9;y++) {
			for(x=0;x<9;x++) {
				printf("%c%d",dame[x][y]?'*':' ',kazu[x][y]);
			}
			puts("");
		}
	}
	return 0;
}

Measured memory_bytes: 0
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define ll long long
int main()
{
    int t;
    cin>>t;
    
    if(t>=400&&t<600)
    {
          cout<<"8"<<endl;
    }
    else if(t>=600&&t<800)
    {
        cout<<"7"<<endl;
    }
    else if(t>=800&&t<1000)
    {
         cout<<"6"<<endl;
    }
    else if(t>=1000&&t<1200)
    {
 cout<<"5"<<endl;
    }
    else if(t>=1200&&t<1400)
    {
 cout<<"4"<<endl;
    }
    else if(t>=1400&&t<1600)
    {
        cout<<"3"<<endl;
    }
    else if(t>=1600&&t<1800)
    {
         cout<<"2"<<endl;
    }
    else if(t>=1800&&t<2000)  cout<<"1"<<endl;
    
    
    


}

Measured memory_bytes: 3636
import java.util.Arrays;

public class Main {
    // field

    // method
    public static void main(String[] args) {
	//System.out.print("> ");
	java.util.Scanner scan = new java.util.Scanner(System.in);
	int arraySize = scan.nextInt();
	String[] input = new String[arraySize];
	int[] array = new int[arraySize];
	//System.out.print("> ");
	for (int i = 0; i < arraySize; i++){
	    array[i] = scan.nextInt();
	}

	InsertionSort is = new InsertionSort(array.clone()); // 挿入ソート
	is.display();        // 表示
	is.insertionSort(); // ソート
    }
}
class InsertionSort{
    // Field
    private int[] sort_array;

    // Constructor
    private InsertionSort(){} 
    public InsertionSort(int[] sort_array){
	this.sort_array = sort_array;
    }

    // Method
    public void display() {
	for (int i = 0; i < this.sort_array.length; i++) {
	    System.out.print(this.sort_array[i]);
	    if(i == this.sort_array.length-1) {
		break;
	    }
	    System.out.print(" ");
	}
	System.out.println();
    }

    public void swap(int x, int y) {
	int temp = this.sort_array[x];
	this.sort_array[x] = this.sort_array[y];
	this.sort_array[y] = temp;
    }
    
    public void insertionSort() {
	/*
	for (int i = 1; i < this.sort_array.length; i++) {
	    int num = this.sort_array[i];
	    for (int j = i - 1; j >= 0; j--) {
		if (this.sort_array[j] > num) {
		    this.sort_array[j + 1] = this.sort_array[j];
		    if (j == 0) {
			this.sort_array[j] = num;
		    }
		} else {
		    this.sort_array[j + 1] = num;
		    break;
		}
	    }
	    this.display();
	}
	*/
	
	// swap文を使うパターン
	for (int i = 1; i < this.sort_array.length; i++) {
	    for (int j = i - 1; j >= 0; j--) {
		if (this.sort_array[j] > this.sort_array[j + 1]) {
		    this.swap(j, j + 1);
		}
	    }
	    this.display();
	}
    }
}



Measured memory_bytes: 33924
N, M = map(int, input().split())
H = list(map(int, input().split()))
H_ok = [1] * N
for i in range(M):
    A, B = map(int, input().split())
    if H[A-1] <= H[B-1]:
        H_ok[A-1] = 0
    if H[B-1] <= H[A-1]:
        H_ok[B-1] = 0

print(sum(H_ok))

Measured memory_bytes: 84892
#include<stdio.h>
#include<string.h>
#define NAMELEN 128


int main(void){
  char *a="Sunny";
  char *b="Cloudy";
  char *c="Rainy";
  char tmp[128];
  
  scanf("%s",tmp);
  
  if(strcmp(a,tmp)==0)
    printf("%s\n",b);
  if(strcmp(b,tmp)==0)
    printf("%s\n",c);
  if(strcmp(c,tmp)==0)
    printf("%s\n",a);
  return 0;
}


Measured memory_bytes: 1600
ii = lambda : int(input())
mi = lambda : map(int,input().split())
li = lambda : list(map(int,input().split()))

n = ii()
alis = li()
import numpy as np
A = np.array(alis,dtype=np.int64)
b = [0] * 61
count = 0
ans = 0
MOD = 10**9 + 7
while A.any():
    one = np.count_nonzero(A & 1)
    k = (1<<count) % MOD
    #ans += (one * (n - one) * pow(2, count, MOD)) % MOD
    ans += (one * (n - one)) * k % MOD
    ans %= MOD
    A >>= 1
    count += 1
 
print(ans)

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

using namespace std;

int main(void)
{
    string c[3];
    int i;

    for(i=0; i<=2; i++){
        cin >> c[i];
    }

    for(i=0; i<=2; i++){
        cout << c[i][i];
    }
    cout << endl;

    return 0;
}

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

int main() {
  int a;
  cin >> a;
  int b;
  cin >> b;
  if (a >= b) {
    a = a - 1;
    if (a >= b) {
      cout << a + 1 + a << endl;
    } else {
      cout << a + 1 + b << endl;
    }
  } else {
    b = b - 1;
    if (a >= b) {
      cout << b + 1 + a << endl;
    } else {
      cout << b + 1 + b << endl;
    }
  }
}

Measured memory_bytes: 256
let ans, n, d = Scanf.scanf " %d %d" @@ fun a b -> ref 0, a, b
let xss = Array.(init n @@ fun _ -> init d @@ fun _ -> Scanf.scanf " %d" (+) 0)
let rec f i n = if i * i >= n then i * i = n else f (i + 1) n
let g n = n * n
let _ = for i = 0 to n - 2 do for j = i + 1 to n - 1 do let s = ref 0 in Array.iteri (fun k x -> s := !s + g (x - xss.(j).(k))) xss.(i); if f 1 !s then incr ans done done; Printf.printf "%d\n" !ans

Measured memory_bytes: 384
#include<stdio.h>
int main(void)
{
	int n,j;
	int a=0;
	scanf("%d",&n);
	j=n;
	while(n>0){
		a+=n%10;
		n/=10;
	}
	if ((j%a)==0)
		printf("Yes\n");
	else
		printf("No\n");
	return 0;
}

Measured memory_bytes: 128
#include<stdio.h>
     
int main(){
  int a, b;
  scanf("%d %d", &a, &b);
  if (a == 1) a = 14;
  if (b == 1) b = 14;
  if (a > b) printf("Alice\n");
  if (a < b) printf("Bob\n");
  if (a == b) printf("Draw\n");
  return 0;
}

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

using namespace std;
#define rep(i, n) for (ll i = 0; i < (n); ++i)
//#define rep(i, n) for (int i = 0; i < (n); ++i)
#define sz(x) ll(x.size())
typedef long long ll;
//typedef pair<int, int> P;
typedef pair<ll, ll> P;
//const double INF = 1e10;
//const ll INF = 10e15;
const ll MINF = -10e10;
const int INF = INT_MAX;
#define cmin(x, y) x = min(x, y)
#define cmax(x, y) x = max(x, y)


//ifstream myfile("C:\\Users\\riku\\Downloads\\0_00.txt");
//ofstream outfile("log.txt");
//outfile << setw(6) << setfill('0') << prefecture << setw(6) << setfill('0') << rank << endl;
// std::cout << std::bitset<8>(9);

typedef priority_queue<P, vector<P>, greater<P>> PQ_ASK;
const int mod = 1000000007;


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

    x -= a;

    x %= b;
    cout << x << endl;

}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
	long long int n,k,q;
	cin>>n>>k>>q;
	vector<long long int> v(n,k-q);
	for(int i=0;i<q;i++){
		int y;
		cin>>y;
		v[y-1]++;
	}
  for(int i=0;i<n;i++){
  	if(v[i]>0)
  	 cout<<"Yes"<<endl;
  	 else
  	   cout<<"No"<<endl;
  }
  return 0;
}

Measured memory_bytes: 1408
[<AutoOpen>]
module Program

open System

let read f = stdin.ReadLine() |> f
let reada f = stdin.ReadLine().Split() |> Array.map f
let reads f = stdin.ReadLine().Split() |> Array.toList |> List.map f

[<EntryPoint>]
let main _ =
    let [w;h;x;y] = reads float
    let mx = w / 2.0
    let my = h / 2.0
    let s = w * h / 2.0
    let t = if (x, y) = (mx, my) then 1 else 0
    printfn "%.10f %i" s t
    0

Measured memory_bytes: 12112
#include <iostream>
#include <cassert>
#include <climits>
#include <bitset>
#include <stack>
#include <queue>
#include <iomanip>
#include <limits>
#include <string>
#include <cmath>
#include <set>
#include <map>
#include <math.h>
#include <algorithm>
#include <vector>
#include <string.h>
#include <tuple>
#include <time.h>
#include <random>
 
using namespace std;
 
typedef long long ll;
typedef pair<ll,ll> P;
 
long long int INF = 3e18;
double Pi = 3.1415926535897932384626;
 
vector<ll> G[500005];
//vector<P> tree[500010];
priority_queue <ll> pql;
priority_queue <P> pqp;
//big priority queue
priority_queue <ll,vector<ll>,greater<ll> > pqls;
priority_queue <P,vector<P>,greater<P> > pqps;
//small priority queue
//top pop
 
int dx[8]={1,0,-1,0,1,1,-1,-1};
int dy[8]={0,1,0,-1,1,-1,-1,1};
char dir[] = "DRUL";
//ll bit[500005];
//↓,→,↑,←
 
 
#define p(x) cout<<x<<endl;
#define el cout<<endl;
#define pe(x) cout<<(x)<<" ";
#define ps(x) cout<<fixed<<setprecision(25)<<x<<endl;
#define pu(x) cout<<(x);
#define pb push_back
#define lb lower_bound
#define ub upper_bound
 
 
ll mod = 1000000007;
ll rui(ll number1,ll number2){
 
    if(number2 == 0){
        return 1;
    }else{
        ll number3 = rui(number1,number2 / 2);
        number3 *= number3;
        number3 %= mod;
        if(number2%2==1){
            number3 *= number1;
            number3 %= mod;
        }
        return number3;
    }
}
ll gcd(ll number1,ll number2){
 
    if(number1 > number2){
        swap(number1,number2);
    }
    if(number1 == 0 || number1 == number2){
        return number2;
    }else{
        return gcd(number2 % number1,number1);
    }
}
void YES(bool condition){
 
    if(condition){
        p("YES");
    }else{
        p("NO");
    }
    return;
}
void Yes(bool condition){
 
    if(condition){
        p("Yes");
    }else{
        p("No");
    }
    return;
}

 
//ll fact[800005],rfact[800005];
/*
void c3_init(){
    fact[0] = rfact[0] = 1;
    for(ll i=1; i<=800000; i++){
        fact[i] = (fact[i-1]*i) % mod;
    }
    rfact[800000] = rui(fact[800000],mod - 2);
    for(ll i=800000; i>=1; i--){
       rfact[i-1] = rfact[i] * i;
       rfact[i-1] %= mod;
    }
    return;}
ll c3(ll n,ll r){
    return (((fact[n] * rfact[r]) % mod) * rfact[n-r]) % mod;}
*/
 
ll n,m,num,sum,ans,a,b,c,d,e,g,h,w,i,j,k,q;
ll x[500005],y[500005];
char s[500005],t[500005];
 
int main(){

    cin >> n;
    for(i=0;i<n;i++){
        cin >> x[i];
        x[i] *= 2;
        num += x[i];
    }
    for(i=n-2;i>=0;i--){
        sum -= x[i];
        sum *= -1;
    }
    if(n % 2 == 0){

    }else{
        sum *= -1;
       // p(sum);
        y[0] = (x[n-1] - sum) / 2;
        for(i=1;i<n;i++){
            y[i] = x[i-1] - y[i-1];
        }
        for(i=0;i<n;i++){
            p(y[i]);
        }
    }
    

    

    return 0;
}


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

const long long mod = 1e9 + 7;

using ll = long long;
using pii  = pair<int, int>;
using pll = pair<ll, ll>;
#define ull unsigned long long
#define ld long double
#define vi vector<int>
#define vll vector<ll>
#define vc vector<char>
#define vs vector<string>
#define vpii vector<pii>
#define vpll vector<pll>

#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; i++)
#define rep1(i, n) for (int i = 1, i##_len = (n); i <= i##_len; i++)
#define repr(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rep1r(i, n) for (int i = ((int)(n)); i >= 1; i--)

#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define RSORT(x) sort(rall(x));
#define pb push_back
#define mp make_pair

#define INF (1e9)
#define PI (acos(-1))
#define EPS (1e-7)

ull gcd(ull a, ull b) { return b ? gcd(b, a % b) : a; }
ull lcm(ull a, ull b) { return a / gcd(a, b) * b; }

const int MAX = 1e5;

int main(){
    int q;
    cin >> q;
    vi l(q), r(q);
    rep(i, q) cin >> l[i] >> r[i];
    vector<bool> f(MAX+1, false);
    f[0] = f[1] = true;
    for (int i=2; i*i<=MAX; ++i) {
        if (f[i]) continue;
        for (int j=i*2; j<=MAX; j+=i) f[j] = true;
    }
    vi b(MAX+1);
    for (int i=1; i<=MAX; i+=2) {
        if (!f[i] && !f[(i+1)/2]) b[i] = 1;
    }
    rep1(i, MAX) b[i] += b[i-1];
    rep(i, q) cout << (b[r[i]]-b[l[i]-1]) << endl;
    return 0;
}


Measured memory_bytes: 4484
N,K,Q=map(int, input().split())
A=[0]*Q
for i in range(0,Q):
  A[i]=int(input())

Score_list=[K]*N
Sum_list=[0]*N
for i in range(0,Q):
  Sum_list[A[i]-1]+=1
 
for i in range(0,N):
  if Q-Sum_list[i]>=K:
    print("No")    
  else:
    print("Yes")

Measured memory_bytes: 9408
#include<stdio.h>
#include<string.h>
int main(void) {
  int N,B[100],i,j,ans=0,M[100],A[100];
  for(i=0;i<100;i++)M[i]=0;
  scanf("%d",&N);
  for(i=0;i<N;i++)scanf("%d",&B[i]);
  for(i=0;i<N;i++) {
    if(B[i] > i+1)ans++;
  }
  if(ans)printf("%d\n",-1);
  else {
    for(i=0;i<N+1;i++) {
      for(j=N-i-1;j>-1;j--) {
        if(B[j] == j+1) {
          M[i]=j+1;
          break;
        }
      }
      for(j=M[i]-1;j<N-i-1;j++) {
        B[j] = B[j+1];
      }
    }
    for(i=N-1;i>-1;i--)printf("%d\n",M[i]);
  }
}

Measured memory_bytes: 128
#include <iostream>
#include<string>
#include<cmath>
#include<algorithm>
#include<cctype>
#include<queue>
#include<deque>
#include<regex>
#include<stack>
#include<stdio.h>
#include<vector>
#include<set>
#include<map>
#include<iomanip>
#define rep(i,n) for(int i=0;i<n;i++)

typedef int long long ll;
using namespace std;
typedef pair<int,int> P;
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
const ll MOD=1e9+7;
static const int MAX = 100;
static const int INF = (1<<23);
template<class T> T gcd(T a, T b){return b? gcd(b,a%b) : a;}
template<class T> T lcm(T a,T b){return a / gcd(a,b)*b;}

int main(){
    cout<<setprecision(16);
    ll n,k;
    cin>>n>>k;
    vector<double> v(n,0);
    rep(i,n){
        cin>>v[i];
    }
    ll l = 0;
    ll r = 1e9;

    while(r-l>1){
        ll mid = (l+r)/2.0;
        ll sum = 0;
        bool f= true;

        rep(i,n){
            ll c = v[i];
            if(mid!=0) {
//                sum += (c / mid);
//
//                if (c % mid == 0)sum--;
sum += (c+mid-1)/mid-1;

            }else{
                f=false;
            }
        }

        if(sum>k&&f){
            l=mid;
        }else{
            r=mid;
        }

    }



    cout<<r<<endl;






    return 0;
}


Measured memory_bytes: 4816
n = int(input())
a = list(map(int,input().split()))
ans = 0
m = abs(a[0])
for i in range(n-1):
    a1 = abs(a[i])
    ans += a1
    if a[i] < 0:
        a[i+1] = a[i+1]*(-1)
    if m > a1:
        m = a1
a1 = abs(a[n-1])
ans += a1
if a[n-1] >= 0:
    m = 0
else:
    if m > a1:
        m = a1
print(ans-2*m)

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

int main() {
    vector<long long> teaSize(4);
    long long N;
    for (int i = 0; i < 4; ++i) {
        cin >> teaSize[i];
    }
    cin >> N;

    for (int i = 0; i < 3; ++i) {
        if (teaSize[i] * 2 < teaSize[i + 1]) teaSize[i + 1] = teaSize[i] * 2;
    }

    long long ans = 0;
    ans += N / 2 * teaSize[3];
    ans += N % 2 * teaSize[2];

    cout << ans << endl;
}

Measured memory_bytes: 256
import java.io.*;
import java.math.*;
import java.util.*;
import java.util.regex.*;


public class Main {

	final static long MOD = 1000000007;
	public static String[] Ws = null;
	public static int wsIndx = 0;
	public static BufferedReader in = null;
	public static long cnt=0;
	public static PrintWriter pw = new PrintWriter(System.out);
	public static void main(String[] args) throws Exception {
//		solveA(args);
//		solveB(args);
//		solveC(args);
		solveD(args);
//		solveE(args);
		if(in!=null){
			in.close();
		}
		pw.flush();
		pw.close();
	}

	public static void solveA(String[] args) throws Exception{
		String a = nextString();
		if('a'<= a.charAt(0) && a.charAt(0) <='z') {
			pw.println("a");

		}else {
			pw.println("A");
		}
	}
	public static void solveB(String[] args) throws Exception{
		int N=nextInt();
		int K=nextInt();

		int[] p = nextInts();
		Arrays.sort(p);
		int ans = 0;
		for(int i=0;i<K;i++) {
			ans+=p[i];
		}
		pw.println(ans);
	}
	public static void solveC(String[] args) throws Exception{
		long n = nextLong();
		String ans = "";
		while((n-1)/26!=0) {
			ans=(char)('a'+(n-1)%26)+ans;
			n=(n-1)/26;
		}
		ans=(char)('a'+(n-1)%26)+ans;
		pw.println(ans);
	}
	public static void solveD(String[] args) throws Exception{
		int N = nextInt();
		long[] A = nextLongs();
		int Q = nextInt();
		long[] B = new long[Q];
		long[] C = new long[Q];
		HashMap<Long,Integer> map = new HashMap<>();
		long ans = 0;
		for(int i=0;i<N;i++) {
			map.put((long)A[i],map.getOrDefault(A[i], 0)+1);
			ans+=A[i];
		}

		for(int i=0;i<Q;i++) {
			B[i]=nextLong();
			C[i]=nextLong();
			ans-=B[i]*map.getOrDefault(B[i], 0);
			ans+=C[i]*map.getOrDefault(B[i], 0);
			if(map.containsKey(B[i])) {
				map.put((long)C[i],map.getOrDefault(C[i], 0)+map.get(B[i]));
				map.put((long)B[i],0);
			}
			pw.println(ans);

		}

	}
	public static void solveE(String[] args) throws Exception{

	}


	public static void check() throws Exception{
		if(in == null){
			in = new BufferedReader(new InputStreamReader(System.in));
		}
		if(Ws==null || Ws.length<=wsIndx){
			Ws = in.readLine().split(" ");
			wsIndx=0;
		}
	}
	public static int nextInt()throws Exception{
		check();
		return Integer.parseInt(Ws[wsIndx++]);
	}

	public static long nextLong()throws Exception{
		check();
		return Long.parseLong(Ws[wsIndx++]);
	}

	public static String nextString()throws Exception{
		check();
		return Ws[wsIndx++];
	}

	public static int[] nextInts()throws Exception{
		check();
		int[] tmp = new int[Ws.length];
		for(int i=0;i<tmp.length;i++){
			tmp[i]=Integer.parseInt(Ws[i]);
		}
		wsIndx=Ws.length;
		return tmp;
	}

	public static long[] nextLongs()throws Exception{
		check();
		long[] tmp = new long[Ws.length];
		for(int i=0;i<tmp.length;i++){
			tmp[i]=Long.parseLong(Ws[i]);
		}
		wsIndx=Ws.length;
		return tmp;
	}

	public static String[] nextStrings()throws Exception{
		check();
		wsIndx=Ws.length;
		return Ws;
	}

}



Measured memory_bytes: 55748
#include <iostream>
#include<cstdio>
using namespace std;
int main(void){
    int a,b,c;
    cin >> a;
    cin >> b;
    cin >> c;
    
    if(a < b && b < c){
    cout << "Yes";
    }
    else{
    cout << "No";
    }
    cout << endl;
    
}


Measured memory_bytes: 3084
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>

#define mod 1000000007
using namespace std;
typedef long long ll;

const int maxn = 1e5 + 10;
ll a[maxn];
ll b[maxn];
int gcd(int a, int b)
{
    if(b == 0)
        return a;
    return gcd(b, a % b);
}
bool cmp(int a,int b)
{
    return a<b;
}
int main()
{
    ll n,m;
    scanf("%lld%lld",&n,&m);
    for(int i=0;i<n;i++)
    {
        scanf("%lld",&a[i]);
    }
    a[n]=m;
    sort(a,a+n+1,cmp);
//    for(int i=1;i<=n+1;i++)
//    {
//        cout<<a[i]<<endl;
//    }
if(n==1)
{
    printf("%lld",abs(a[1]-a[0]));
    return 0;
}
else if(n==2){
    ll aa=a[2]-a[1];
    ll aaa=a[1]-a[0];
    printf("%lld",gcd(aa,aaa));
    return 0;
}

    for(int i=0;i<n;i++)
    {
        b[i]=a[i+1]-a[i];
    }

    ll x=b[0];
    for(int i=1;i<n-1;i++)
    {
        x=gcd(x,b[i]);
    }
    printf("%lld",x);



    return 0;
}





Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
const int maxn=1e6+23;

int cnt[maxn];
int main(){
    int n;
    cin>>n;
    n*=2;
    for(int i=1;i*i<=n;i++){
        for(int j=1;j*j<=n;j++){
            for(int k=1;k*k<=n;k++){
                int d=(i+j)*(i+j)+(j+k)*(j+k)+(i+k)*(i+k);
                if(d<=n){
                    cnt[d]++;
                }
            }
        }
    }
    for(int i=2;i<=n;i+=2) printf("%d\n",cnt[i]);
}

Measured memory_bytes: 3604
#include <bits/stdc++.h>
using namespace std;
#define rep0(i,n) for(ll (i) = 0; (i) < (n); ++(i))
#define rrep0(i,n) for(ll (i) = (n) - 1; (i) >= 0; --(i))
#define rep1(i,n) for(ll (i) = 1; (i) <= (n); ++(i))
#define rrep1(i,n) for(ll (i) = (n); (i) >= 1; --(i))
#define nfor(i,a,b) for(ll (i) = (a); (i) < (b); ++(i))
#define rfor(i,a,b) for(ll (i) = (a); (i) > (b); --(i))
#define ll long long
#define mod (1000000007)
#define pf(a) cout << (a) << endl;
#define all(x) (x).begin(),(x).end()

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

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

ll factorial(ll n){
    ll t = 1;
    rep1(i, n)t *= i;
    return t;
}

ll combinations(ll n, ll k) {
    ll r = 1;
    for (ll d = 1; d <= k; ++d) {
        r *= n--;
        r /= d;
    }
    return r;
}

int main()
{
    int x,a,b,cnt5,cnt4,cnt3,cnt2 ,cnt1;
    cin >> x;
    a = x / 100 * 100;
    b = x - a;
    cnt5 = b / 5;
    b -= cnt5 * 5;
    cnt4 = b / 4;
    b -= cnt4 * 4;
    cnt3 = b / 3;
    b -= cnt3 * 3;
    cnt2 = b / 2;
    b -= cnt2 * 2;
    cnt1 = b / 1;
    if(cnt1 + cnt2 + cnt3 + cnt4 + cnt5 <= a / 100)pf(1)
        else pf(0)
    return 0;
}


Measured memory_bytes: 256
a = input()

a = a.split()

r = int(a[0])
g = int(a[1])
b = int(a[2])

number = r * 100 + g * 10 + b

"""
print(a)
print(r)
print(g)
print(b)
print(number)
"""

if number % 4 == 0:
    print("YES")
else:
    print("NO")


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

int main(){
    int N,M; cin >> N >> M;
    if (N==M && N!=0) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 256
//bismillahir rahmanir rahim            //Author:Fayed Anik
 
#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
 
using namespace std;
//using namespace __gnu_pbds;
 
/*
template <typename T>  using ordered_set =
    tree<T, null_type, less<T>,   /// greater<T> for sorting decreasingly
    rb_tree_tag, tree_order_statistics_node_update>;
*/

#define         ll                          long  long
#define         lf                          double
#define         pb(x)                       push_back(x)
#define         ull                         unsigned long long
#define         sfl(a)                      scanf("%lld",&a)
#define         sf(a)                       scanf("%d",&a)
#define         pf(a)                       printf("%d\n",a)
#define         pfl(a)                      printf("%lld\n",a)
#define         FOR(x,n)                    for(ll x=1;x<=n;++x)
#define         pii                         pair< ll , ll >
#define         SET(m)                      memset(m, 1,sizeof m)
#define         RESET(m)                    memset(m,0,sizeof m)
#define         mp(a,b)                     make_pair(a,WWb)
#define         mod                         1000000007
#define         INF                         1e17
#define         f1                          first
#define         f2                          second
#define         all(v)                      v.begin(),v.end()
#define         PI                          acos(-1)
#define         printminusone               printf("-1\n")
#define         bug                         printf("bug")
#define         FILEIN                      freopen("in.txt","r",stdin)
#define         FILEOUT                     freopen("out.txt","w",stdout)
 
//ll SET(ll mask,ll pos){ return mask = (mask | (1ll<<pos)); }
//ll RESET(ll mask,ll pos){ return mask = mask & ~(1ll<<pos); }
//bool CHECK(ll mask,ll pos) { return (bool) (mask & (1ll<<pos)); }
//priority_queue <ll, vector<ll>, greater<ll> > pq;

pii a[1005];
ll dp[1005][10005];

bool comp(pii x,pii y){
    return x.f1*y.f2 < x.f2*y.f1;
}
ll F(ll pos,ll ache){
    if(pos<1){
        if(ache<=0){
            return 0;
        }
        else{
            return INF;
        }
    }
    if(ache<=0){
        return 0;
    }
    ll &ret=dp[pos][ache];
    if(ret!=-1) return ret;
    ret = a[pos].f2+F(pos,ache-a[pos].f1);
    ret = min(ret,F(pos-1,ache));
    return dp[pos][ache]=ret;
}
int main(){
    ll h,n;
    sfl(h),sfl(n); 
    for(ll i=0;i<=n;i++){
        for(ll j=0;j<=h;j++) dp[i][j]=-1;
    } 
    FOR(i,n){
        sfl(a[i].f1);
        sfl(a[i].f2);
    }
    ll ans=F(n,h);
    pfl(ans);
}

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

int main(){
  int n,a,b;
  cin >> n >> a >> b;
  
  int ans=0;
  for (int i=0;i<=n;++i){
    int sum=0;//sum=桁の和
    int x=i;//一時的な変数
    for (int j=0;j<5;++j){//j出てこないけど？
      sum+=x%10;//一の位の数字をsumに加算(ex)①139%10=9,139/10=13②13%10=3,13/10=1③1%10=1,1/10=0)
      x/=10;
    }
    if (a<=sum&&sum<=b){
      ans+=i;
    }
  }
    cout << ans << endl;
}
  
    


Measured memory_bytes: 256
N = int(input())
A = list(map(int, input().split()))
ans = 0
mod = pow(10,9)+7

B = []
x = 0
for i in range(N-1):
    x += A[i]
    x %= mod
    B.append(x)

ans = 0
for i in range(1,N):
    ans += A[i]*B[i-1]
    ans %= mod

print(ans)


Measured memory_bytes: 31496
// ====================================
//   author: M_sea
//   website: https://m-sea-blog.com/
// ====================================
#include <bits/stdc++.h>
#define file(x) freopen(#x".in","r",stdin); freopen(#x".out","w",stdout)
using namespace std;
typedef long long ll;

int read() {
	int X=0,w=1; char c=getchar();
	while (c<'0'||c>'9') { if (c=='-') w=-1; c=getchar(); }
	while (c>='0'&&c<='9') X=X*10+c-'0',c=getchar();
	return X*w;
}

const int N=100000+10;

int n; char s[N];

int main() {
	scanf("%s",s+1); n=strlen(s+1);
	int ans=0;
	for (int i=1,x=0,y=0;i<=n;++i) {
		if (s[i]=='g') {
			if (x>y) ++y,++ans;
			else ++x;
		} else {
			if (x>y) ++y;
			else ++x,--ans;
		}
	}
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 3888
<?php
$sc = new Scanner();
$a = $sc->nextInt();
$b = $sc->nextInt();

$ans = $a * $b;
if ($ans % 2 === 0) {
    out::println('Even');
} else {
    out::println('Odd');
}

class Scanner
{
    private $arr = [];
    private $count = 0;
    private $pointer = 0;

    public function next()
    {
        if ($this->pointer >= $this->count) {
            $str = trim(fgets(STDIN));
            $this->arr = explode(' ', $str);
            $this->count = count($this->arr);
            $this->pointer = 0;
        }
        $result = $this->arr[$this->pointer];
        $this->pointer++;
        return $result;
    }

    public function hasNext()
    {
        return $this->pointer < $this->count;
    }

    public function nextInt()
    {
        return (int)$this->next();
    }

    public function nextDouble()
    {
        return (double)$this->next();
    }
}

class out
{
    public static function println($str = "")
    {
        echo $str . PHP_EOL;
    }
}

Measured memory_bytes: 5112
#include<iostream>
#include<string.h>
using namespace std;
#define MAX 3000

int dp[MAX][MAX];
string getLcs(string& s1,string& s2,int len)
{
int i=0,j=0;
string lcs;
	while(len>0)
	{
		if(s1[i]==s2[j])
		{
			lcs.push_back(s1[i]);
			i++;
			j++;
			len--;
		}
		else
		{
			if(dp[i+1][j]<dp[i][j+1])
			{
			 j++;
			}
			else
			{
			i++;
			}
		}
	}
	return lcs;
}
int find_lcsLen(string& s1,string& s2,int i,int j)
{
	if(i>=s1.length() || j>=s2.length())
		return 0;

	if(dp[i][j]!=-1)
		return dp[i][j];

	if(s1[i]==s2[j])
	{
		return dp[i][j]=1+find_lcsLen(s1,s2,i+1,j+1);
	}
	else
	{
	 return dp[i][j]=max(find_lcsLen(s1,s2,i+1,j),find_lcsLen(s1,s2,i,j+1));
	}
}
string solve(string s1,string s2)
{
	
		memset(dp,-1,sizeof dp);

		int len=find_lcsLen(s1,s2,0,0);
		

		return getLcs(s1,s2,len);


}
int main()
{
	string s,t;

	cin>>s>>t;


	cout<<solve(s,t)<<endl;


	return 0;
}

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

#include <boost/range/adaptors.hpp>
#include <boost/range/irange.hpp>

using namespace std;
using namespace boost;
using namespace boost::adaptors;

int main() {
    int64_t n, m, k;
    cin >> n >> m >> k;

    vector a(n, 0L), b(m, 0L);
    for (auto&& aa : a) {
        cin >> aa;
    }
    for (auto&& bb : b) {
        cin >> bb;
    }

    vector sa(1, 0L), sb(1, 0L);
    for (auto aa : a) {
        sa.push_back(sa.back() + aa);
    }
    for (auto bb : b) {
        sb.push_back(sb.back() + bb);
    }

    int64_t ans = 0;
    for (auto i : irange(0L, n + 1)) {
        int64_t s = sa[i];

        if (s > k) {
            break;
        }

        int64_t t =
                i + (upper_bound(sb.begin(), sb.end(), k - s) - sb.begin() - 1);
        ans = max(ans, t);
    }

    cout << ans << endl;
}

Measured memory_bytes: 11116
#include<stdio.h>
#include<string.h>
#include<ctype.h>
char stack[1000000];
int top;

void push(char);
void pop(void);
int empty(void);

int main(void){
char str[101];
 int i,flag;
  while(1){
    scanf("%[^\n]%*c",str);
    if(str[0]=='.'&&strlen(str)==1)break;

    top=0;
    flag=1;
    for(i=0;i<strlen(str);i++){
      if(str[i]=='('||str[i]=='[')push(str[i]);
      else if((str[i]==')'&&stack[top-1]=='(')||(str[i]==']'&&stack[top-1]=='['))pop();
      else if((str[i]==')'||str[i]==']')&&empty()){flag=0;break;}
      else if((str[i]==']'&&stack[top-1]=='(')||(str[i]==')'&&stack[top-1]=='[')){flag=0;break;}
    }
    printf((flag && empty())?"yes\n":"no\n");
  }
  return 0;
}

void push(char x){
  stack[top]=x;
  top++;
}

void pop(void){
  top--;
}

int empty(void){
  return (top==0)?1:0;
}

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

using namespace std;
int main(){
int a,b;
cin>>a>>b;

if(a==0){
if(b<1912)cout<<"M"<<b-1867<<endl;
else if(b<1926)cout<<"T"<<b-1911<<endl;
else if(b<1989)cout<<"S"<<b-1925<<endl;
else cout<<"H"<<b-1988<<endl;
}
else if(a==1)cout<<1867+b<<endl;
else if(a==2)cout<<1911+b<<endl;
else if(a==3)cout<<1925+b<<endl;
else cout<<1988+b<<endl;

}



Measured memory_bytes: 3132
import java.util.*;
class Main { 
	public static void main(String...args) {
		Scanner scan = new Scanner(System.in);
		int aryLen = scan.nextInt();
		int[] ary = new int[aryLen];
		int min = 0;
		int count = 0;
		int point = 0;
		for(int i = 0 ; i < aryLen; i++ ) {
			ary[i] = scan.nextInt();
		}

		for(int n = 0; n < aryLen; n++) {
			min = ary[n];
			for(int j = n + 1; j < aryLen; j++) {
				if(ary[j] < min) {
					min = ary[j];
					point = j;
				}
			}
			if(min != ary[n]) {
				count++;
				ary[point] = ary[n];
				ary[n] = min;
			}
		}
		for(int k = 0; k < aryLen; k++) {
			System.out.print(ary[k]);
			if(k != aryLen-1 ) {
				System.out.print(" ");
			} else {
				System.out.println();
			}
		}
		System.out.println(count);
	}
}


Measured memory_bytes: 26272
# 2020/04/25
# AtCoder Beginner Contest 072 - C

# Input
n = int(input())
a = list(map(int, input().split()))

# Calc
alist = list()

for i in range(n):
    alist.append(a[i]-1)
    alist.append(a[i])
    alist.append(a[i]+1)

tlist = [0] * 100002
for i in range(len(alist)):
    tlist[alist[i]] = tlist[alist[i]] + 1

# Output
print(max(tlist))


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

using namespace std;

using int64 = long long;
const int mod = 1e9 + 7;
//const int mod = 998244353;

const int64 infll = (1LL << 62) - 1;
const int inf = (1 << 30) - 1;

struct IoSetup {
  IoSetup() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);
    cerr << fixed << setprecision(10);
  }
} iosetup;


template< typename T1, typename T2 >
ostream &operator<<(ostream &os, const pair< T1, T2 > &p) {
  os << p.first << " " << p.second;
  return os;
}

template< typename T1, typename T2 >
istream &operator>>(istream &is, pair< T1, T2 > &p) {
  is >> p.first >> p.second;
  return is;
}

template< typename T >
ostream &operator<<(ostream &os, const vector< T > &v) {
  for(int i = 0; i < (int) v.size(); i++) {
    os << v[i] << (i + 1 != v.size() ? " " : "");
  }
  return os;
}

template< typename T >
istream &operator>>(istream &is, vector< T > &v) {
  for(T &in : v) is >> in;
  return is;
}

template< typename T1, typename T2 >
inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }

template< typename T1, typename T2 >
inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }

template< typename T = int64 >
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);
}

template< typename F >
struct FixPoint : F {
  FixPoint(F &&f) : F(forward< F >(f)) {}

  template< typename... Args >
  decltype(auto) operator()(Args &&... args) const {
    return F::operator()(*this, forward< Args >(args)...);
  }
};

template< typename F >
inline decltype(auto) MFP(F &&f) {
  return FixPoint< F >{forward< F >(f)};
}

int main() {
  int64 X;
  cin >> X;
  int64 Q = X / 500;
  X -= Q * 500;
  cout << Q * 1000 + X / 5 * 5 << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long n,k;
    cin>>n>>k;
    long long a[n+1],sum=0;
    for(int i=0;i<n;i++)
    {
        cin>>a[i];
    }
    sort(a,a+n);
    for(int i=0;i<n-k;i++)
    {
        sum+=a[i];
    }
    cout<<sum<<endl;
}


Measured memory_bytes: 5140
#include <iostream>
#define inf 1000000000

using namespace std;

int N, T;
int A[100005];
int dif[100005];

int main(void)
{
	cin >> N >> T;
	for(int i = 0; i < N; i++) cin >> A[i];
	
	int m = inf, M = -inf;
	for(int i = 0; i < N; i++){
		dif[i] = A[i] - m;
		M = max(M, dif[i]);
		m = min(m, A[i]);
	}
	
	int ans = 0;
	for(int i = 0; i < N; i++){
		if(dif[i] == M) ans++;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define srep(i,n,m) for(int i=n;i<m;i++)
#define elif else if
#define INF 1000000007
using namespace std;
int gcd(int a,int b){
    if(b==0) return a;
    return gcd(b,a%b);
}
int n,m,cnt=100,o,p,aa[220000],cntl=0,ab[220000];
pair<int,int> pp[220000];
string s,ss[220000];
char c,cc[220000];
queue<int> que;
signed main(){
    cin>>n;
    while(1){
        m++;
        cnt+=cnt/100;
        if(cnt>=n){
            cout<<m;
            return 0;
        }
    }
}

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

const int N = 200005;

int n, a[N];
deque<int> dq;

int main(){
    scanf("%d", &n);
    for(int i = 1; i <= n; i++){
        scanf("%d", a + i);
        if(i & 1) dq.push_back(i);
        else dq.push_front(i);
    }
    for(int i = 1; i <= n; i++){
        if(n & 1){
            printf("%d ", a[dq.back()]);
            dq.pop_back();
        }
        else{
            printf("%d ", a[dq.front()]);
            dq.pop_front();
        }
    }
}

Measured memory_bytes: 3840
# -*- coding: utf-8 -*-
import sys
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
input=lambda: sys.stdin.readline().rstrip()
YesNo=lambda b: bool([print('Yes')] if b else print('No'))
YESNO=lambda b: bool([print('YES')] if b else print('NO'))
int1=lambda x:int(x)-1

def main():
    print(len(set(list(map(int,input().split())))))

if __name__ == '__main__':
    main()


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



// ヒープソート(昇順) *****************

int A[200001], B[200001], tmp; // Bでソート(Aは従属) 必要に応じて要素数と型を変える
int length;                    // 要素数:sort()を呼び出す前に設定する


void swap(int i, int j) {
    int tmp;
    tmp  = A[i];
    A[i] = A[j];
    A[j] = tmp;
    tmp  = B[i];
    B[i] = B[j];
    B[j] = tmp;
}

void downheap(int k, int r) {
    int j, v, w;
    v = B[k];
    w = A[k];
    while (1) {
        j = 2 * k + 1;
        if (j > r) break;
        if (j != r) {
            if (B[j + 1] > B[j]) {
                j = j + 1;
            }
        }
        if (v >= B[j]) break;
        B[k] = B[j];
        A[k] = A[j];
        k = j;
    }
    B[k] = v;
    A[k] = w;
}

void sort() {
    int i;
    for (i = (length - 2) / 2; i >= 0; i--) {
        downheap(i, length - 1);
    }
    for (i = length - 1; i > 0; i--) {
        swap(0, i);
        downheap(0, i - 1);
    }
}

// ***************** ヒープソート(昇順) 

int main() {
  int N;
  int i;
  double result;
  scanf ("%d", &N);
  
  for (i=0;i<N;i++) {
      scanf("%d", &B[i]);
  }
  
  length = N;
  sort();
  
  result = B[0];
  for (i=1;i<N;i++) {
      result = (result + B[i]) / 2.0;
  }
  
  printf("%f", result);
  return 0;
}




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

signed main(void)
{
	int n, cnt;
	cin >> n;
	int h[n];
	bool ok, flag;

	rep(i, n) cin >> h[i];
	cnt = 0;
	ok = true;
	while(ok)
	{
		flag = false;
		rep(j, n)
		{
			if (flag && h[j] == 0)
			{
				flag = false;
				cnt++;
			}
			if (h[j] > 0)
			{
				h[j]--;
				flag = true;
			}	
		}
		if (flag) cnt++;
		ok = false;
		rep(i, n)
		{
			if (h[i] > 0)
				ok = true;
		}
	}
	cout << cnt << endl;
	return 0;
}


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

using namespace std;

int vals[100005];
int dp[100005];

int f(int n){
    if(n == 0){
        return 0;
    }

    if(dp[n] != -1){
        return dp[n];
    }

    int left = INT_MAX;
    int right = INT_MAX;

    if(n-1 >= 0){
        left = f(n-1) + abs(vals[n-1] - vals[n]);
    }
    if(n-2 >= 0){
        right = f(n-2) + abs(vals[n-2] - vals[n]);
    }

    dp[n] = min(left, right);

    return dp[n];
}

int main(){
    int n;

    cin >> n;

    for(int i = 0;i<n;i++){
        cin >> vals[i];
        dp[i] = -1;
    }

    cout << f(n-1) << endl;
    
}

Measured memory_bytes: 9028
#include<iostream>
#include<utility>
#include<cstdio>
#include<vector>
#include<cmath>
#include<climits>
#include<map>

using namespace std;

#define mp make_pair
#define rep(i,n) for( int i = 0; i < n; i++ )
#define B 20
#define S 19
#define debug puts("D")
typedef vector<int,int> V;
typedef long long int ll;

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

	rep(i,n)
	{
		int y,m,d,count=0;
		cin >> y >> m >> d;
		

		while( y != 1000 )
		{
			if( y%3 == 0 )
			{
				if( d < B && m <= 10)
					d++;
				else if( m < 10 )
				{
					d = 1;
					m++;
				}
				else
				{
					y++;
					d = 1;
					m = 1;
				}
			}
			else if ( m%2 == 0 )
			{
				if( d < S && m <= 10 )
					d++;
				else if( m < 10 )
				{
					d = 1;
					m++;
				}
				else
				{
					y++;
					d = 1;
					m = 1;
				}
			}
			else
			{
				if( d < B && m <= 10 )
					d++;
				else if( m < 10 )
				{
					d = 1;
					m++;
				}
				else
				{
					y++;
					d = 1;
					m = 1;
				}
			}
			count++;
		}
		cout << count << endl;
	}
	return 0;
}

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

#define rep(i,n) for(int i=0; i<n ; ++i)
#define REP(i,a,b) for(int i=a; i<b; ++i)
using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using vvi = vector<vector<int>>;
using vvl = vector<vector<ll>>;
using vvc = vector<vector<char>>;

//プロトタイプ宣言
void faster(void);
template <class T>
T gcd(T , T);
template <class T>
T get_digent(T);
template <class T>
T POW(T , T);

int h,w;
vvc s;
int dy[] = {1,0,-1,0} , dx[] = {0,1,0,-1};
vvi cost;


int bfs(void){
  queue<pair<int,int>> que;
  que.push(make_pair(0,0));
  cost[0][0]=0;

  while(!que.empty()){
    pair<int,int> p = que.front();
    que.pop();

    if(p == (make_pair(h-1,w-1))){
      return cost[h-1][w-1];
    }

    rep(i,4){
      int ny = p.first + dy[i] , nx = p.second + dx[i];
      if(ny<0||nx<0||ny>=h||nx>=w) continue;
      if(s[ny][nx]=='#') continue;
      if(cost[ny][nx]!=-1) continue;

      que.push(make_pair(ny,nx));
      cost[ny][nx] = cost[p.first][p.second] + 1;
    }
  }

  return -1;
}

int main(){
  faster();
  cin >> h >> w;
  s = vvc(51,vector<char>(51));
  int white=0;
  rep(i,h)rep(j,w){
    cin >> s[i][j];
    if(s[i][j]=='.') white++;
  }
  cost = vvi(51,vi(51,-1));
  int ans,temp;
  temp = bfs();
  if(temp==-1) cout << -1 << endl;
  else{
    ans = white - temp - 1;
    cout << ans << endl;
  }
}



























//同期解除
void faster(void){
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
}

//ユークリッドの互除法
template <class T>
T gcd(T a, T b) {
  return (b ? gcd(b, a%b) : a);
} 

//桁数取得
template <class T>
T get_digent(auto x){
  string s;
  s = to_string(x);
  ll digent = s.size();
  return digent;
} 

//べき乗計算
template <class T>
T POW(T x, T y){
  if(y==0) return 1;
  if(y%2 == 1){
    ll temp = POW(x,y-1);
    return (temp*x);
  }
  else{
    ll temp = POW(x,y/2);
    return temp*temp;
  }
} 



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

int main() {
  int a,n,c;
  cin >> n >> a;
  c=(a+n)/2;
  if((a+n)%2!=0)
  	cout << c+1 << endl;
  else
    cout << c <<endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<ll> vi;
#define INF (1e9)

int main() {
    ll N, M, ans = 0;
    cin >> N >> M;
    vi a(N), b(N), c(M), d(M);
    for (ll i = 0; i < N; i++) {
        cin >> a[i] >> b[i];
    }
    for (ll i = 0; i < M; i++) {
        cin >> c[i] >> d[i];
    }
    for (ll i = 0; i < N; i++) {
        ll point = 0, dist = INF;
        for (ll j = 0; j < M; j++) {
            ll x = abs(a[i] - c[j]) + abs(b[i] - d[j]);
            if (x < dist) {
                dist = x;
                point = j + 1;
            }
        }
        cout << point << endl;
    }
}


Measured memory_bytes: 256
/*==============================================*\
ID:          shahidul_brur
 
Name:     Md. Shahidul Islam
Study:      CSE, BRUR
Address:  Rangpur, Bangladesh
 
 mail: shahidul.cse.brur@gmail.com
 FB  : fb.com/shahidul.brur
 Blog: shahidul-brur.blogspot.com(in Bengali),
       shahidul-brur-en.blogspot.com(in English)
\*===============================================*/
#include<bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp> // Common file
//#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
//using namespace __gnu_pbds;
using namespace std;
//typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;

//#pragma GCC optimize("O3")
//#pragma GCC optimize("unroll-loops")
//#pragma GCC target("avx,avx2,fma")

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef pair<ll, int> li;
typedef pair<int, ll> il;
typedef vector<ii> vii;
typedef vector<il> vil;
typedef vector<li> vli;
 
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define sz size()
#define all(a)  a.begin(), a.end()
#define mem(a, b)     memset(a, b, sizeof(a))
#define f0(i,b) for(int i=0;i<(b);i++)
#define f1(i,b) for(int i=1;i<=(b);i++)
#define f2(i,a,b) for(int i=(a);i<=(b);i++)
#define fr(i,b,a) for(int i=(b);i>=(a);i--)
#define rep(i,a,b,c) for(int i=(a);i!=(b);i+=(c))
 
int dx8[] = {0, 0, 1, 1, 1, -1, -1, -1};
int dy8[] = {1,-1, 1, -1, 0, 0, -1, 1};
int dx4[] = {0, 0, 1, -1};
int dy4[] = {1, -1, 0, 0};

const double pi = acos(-1.0);
const double eps = 1e-6;
const int mod = (int)1e9+7;
const int maxn = (int)2e5+5;
const int logn = 20;
int a[maxn];
int main()
{
    ios_base::sync_with_stdio(0); cin.tie(NULL); cout.tie(NULL);
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    int n;
    cin>>n;
    f1(i,n) cin>>a[i];
    int c = 0;
    f1(i,n){
        int nw = 0;
        while(i+1<=n && a[i+1]<=a[i]){
            nw++;
            i++;
        }
        c = max(c,nw);
    }
    cout << c;
    return 0;
}


Measured memory_bytes: 640
#include<iostream>
using namespace std;
int main()
{
  int n;
  cin>>n;
  for(int i=0;i<1000;i++)
    for(int j=0;j<1000;j++)
      if(4*i+7*j==n)
        return cout<<"Yes",0;
  cout<<"No";

  return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#define MAX 100000

int A[MAX],n;

int partition(int p,int r){
int x,i,j,t;
x=A[r];
i=p-1;
for(j=p;j<r;j++){
if(A[j]<=x){
i++;
t=A[i];
A[i]=A[j];
A[j]=t;
}
}
t=A[i+1];
A[i+1]=A[r];
A[r]=t;
return i+1;
}

int main(){
int i,q;
scanf("%d",&n);
for(i=0;i<n;i++){
scanf("%d",&A[i]);
}
q=partition(0,n-1);

for(i=0;i<n;i++){
if(i)
printf(" ");
if(i==q)
printf("[");
printf("%d",A[i]);
if(i==q)
printf("]");
}
printf("\n");

return 0;
}


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

void rule(vector<string>&s,char turn){
    //cout<<"player:"<<turn<<endl;
    turn=turn-'a';
    //cout<<"size:"<<s.at(turn).size()<<endl;
    //cout<<"Now Card:"<<s.at(turn)<<endl;
    if(s.at(turn).empty()){
        printf("%c\n",turn+'A');
        exit(0);
    }
    char next=s.at(turn).at(0);
    s.at(turn).erase(s.at(turn).begin());
    rule(s,next);
}

int main(){
    vector<string>vec(3);
    for(int i=0;i<3;i++)cin>>vec.at(i);
  
    //cout<<"CARD"<<endl;
    //for(int i=0;i<3;i++)cout<<vec.at(i)<<endl;
  
    rule(vec,'a');
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
using namespace std;
using ll = long long;
using P = pair<int, int>;
using vi = vector<int>;
using vc = vector<char>;
using vb = vector<bool>;
using vs = vector<string>;
using vll = vector<long long>;
using vp = vector<pair<int, int>>;
using vvi = vector<vector<int>>;
using vvc = vector<vector<char>>;
using vvll = vector<vector<long long>>;
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 (b<a) {a=b; return 1;} return 0;}

vector<long long> enum_div(long long n) {
    vector<long long> res;
    for (long long i = 1; i*i <= n; i++) {
        if (n%i) continue;
        res.push_back(i);
        if (i*i != n) res.push_back(n/i);
    }
    sort(res.begin(), res.end());
    return res;
}

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

    ll n;
    cin >> n;
    auto div = enum_div(n);
    ll ans = 0;
    for (ll x : div) {
        ll m = x - 1;
        if (n/x <= m-1) ans += m;
    }
    cout << ans << endl;
}


Measured memory_bytes: 384