akhauriyash/Code-Regression huggingface dataset:
#define rep(i, n) for (int i = 0; i < (n); i++)
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
const ll MOD = 1000000007;

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

    ll power = 1;
    rep(i, N) {
        power *= (i + 1);
        power %= MOD;
    }

    cout << power << endl;
    return 0;
}

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

int main(){
    string S;
    cin >> S;
    int ans = 9999;
    
    rep(i, S.size()-2){
        string tmp;
        tmp = tmp + S[i] +S[i+1] + S[i+2];
        int tmpnum = stoi(tmp);
        ans = min(ans, abs(753 - tmpnum));
    }

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

Measured memory_bytes: 3572
#!/usr/bin/python3
# import bisect
# from collections import Counter, deque, OrderedDict, defaultdict
# from copy import copy, deepcopy # pythonのみ．copyは1次元，deepcopyは多次元．
# from decimal import Decimal, ROUND_HALF_UP, ROUND_HALF_EVEN
# from functools import reduce
# from heapq import heapify, heappop, heappush
# from itertools import accumulate, permutations, combinations, combinations_with_replacement, groupby, product
# import math
# import numpy as np  # Pythonのみ！
# from operator import xor
# import re
# from scipy.sparse.csgraph import connected_components  # Pythonのみ！
# ↑cf.  https://note.nkmk.me/python-scipy-connected-components/
# from scipy.sparse import csr_matrix
# import statistics # Pythonのみ
# import string
import sys
sys.setrecursionlimit(10 ** 5 + 10)
def input(): return sys.stdin.readline().strip()

def resolve():
    
    """
    https://qiita.com/drken/items/4a7869c5e304883f539b#3-3-dfs-%E3%81%AE%E5%86%8D%E5%B8%B0%E9%96%A2%E6%95%B0%E3%82%92%E7%94%A8%E3%81%84%E3%81%9F%E5%AE%9F%E8%A3%85
    cf. https://atcoder.jp/contests/abc138/submissions/13273052
    """
    
    from collections import deque
    
    
    N, M = map(int, input().split())  # 頂点数，辺数
    # グラフ入力受取 (ここでは無向グラフを想定)
    G = [[] for _ in range(N)]


    for i in range(M):
        l, r,d = map(int, input().split())
        l-=1
        r-=1
        G[l].append((r,d))
        G[r].append((l,-d))
    
    seen = [False]*N
    ans = [0]*N
    
    
    def dfs(G, v):
    
        # (根の親番号が必要なときは-1とする)
    
        seen[v] = True
        stack = deque([v])
        while stack:
            v = stack.pop()
            for next_v,cost in G[v]:
                if not seen[next_v]:
                    ans[next_v] =ans[v]+cost
                else:
                    if ans[next_v] !=ans[v]+cost:
                        return 'No'
                    else: continue

                seen[next_v] = True
                stack.append(next_v)
    
    
    def main():
        for i in range(N):
            if not seen[i]:
                if dfs(G,i)=='No':
                    return 'No'
                    break
                else:
                    continue
        return 'Yes'
    print(main())
    
    
resolve()

Measured memory_bytes: 103476
#include <iostream>
#include <string>
#include <string.h>
#include <set>
using namespace std;
int main()
{
	string s;
	cin>>s;
	s[0]='2';
	s[1]='0';
	s[2]='1';
	s[3]='8';
	cout<<s; 
	return 0;
}


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

int main() {
	int h, w;
	while(cin>>h>>w && !(h==0 && w==0))
	{
		for(int i = 0; i<h; i++)
		{
			for(int j=0; j<w; j++)
			{
				cout<<"#";
			}
			cout<<endl;
		}
		cout<<endl;
	}

	return 0;
}



Measured memory_bytes: 3068
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using ld=long double;
int main(){
    int i,j;
    int n;
    ld gy=0;
    ld daiwan=0;
    ld daitwo=0;
    ld ans=0;
    cin >> n;
    vector<ld> a(n);
    for(i=0;i<n;i++){
        cin >> a.at(i);
        gy=1/a.at(i);
        // cout << gy;
        daiwan+=gy;
    }
    //cout << daiwan << endl;

    ans=1/daiwan;
    cout << setprecision(16);
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 384
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

const mod = 1000000007

// 1MB
const ioBufferSize = 1 * 1024 * 1024

var sc = func() *bufio.Scanner {
	sc := bufio.NewScanner(os.Stdin)
	sc.Buffer(make([]byte, ioBufferSize), ioBufferSize)
	sc.Split(bufio.ScanWords)
	return sc
}()

func next() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func main() {
	n := nextInt()

	a := make([]int, n)
	for i := 0; i < n; i++ {
		a[i] = nextInt()
	}

	max, second := -1, -1
	for i := 0; i < n; i++ {
		if max == -1 || a[max] < a[i] {
			second = max
			max = i
		} else if second == -1 || a[second] < a[i] {
			second = i
		}
	}

	for i := 0; i < n; i++ {
		if i == max {
			fmt.Println(a[second])
		} else {
			fmt.Println(a[max])
		}
	}
}


Measured memory_bytes: 6528
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

const (
	maxBufferSize     = 2000000 // check
	initialBufferSize = 20000
)

func JoinInt(a []int, sep string) string {
	aStrs := make([]string, len(a))
	for i := 0; i < len(a); i++ {
		aStrs[i] = strconv.Itoa(a[i])
	}
	return strings.Join(aStrs, sep)
}

func solve() {
	sc := bufio.NewScanner(os.Stdin)
	buffer := make([]byte, initialBufferSize)
	sc.Buffer(buffer, maxBufferSize)

	sc.Scan()
	n, _ := strconv.Atoi(sc.Text())
	sc.Scan()
	args := strings.Split(sc.Text(), " ")
	a := make([]int, n)
	for i := 0; i < n; i++ {
		a[i], _ = strconv.Atoi(args[i])
	}

	b := make([]int, n)
	for i := n - 1; i >= 0; i-- {
		sum := 0
		for j := (i + 1) * 2; j <= n; j += (i + 1) {
			sum += b[j-1]
		}
		if sum%2 != a[i] {
			b[i] = 1
		} else {
			b[i] = 0
		}
	}

	var ans []int
	m := 0
	for i := 0; i < n; i++ {
		if b[i] == 1 {
			ans = append(ans, i+1)
			m++
		}
	}

	fmt.Println(m)
	if m != 0 {
		fmt.Println(JoinInt(ans, " "))
	}
}

func main() {
	solve()
}


Measured memory_bytes: 10752
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef set<int> S;
typedef queue<int> Q;
typedef queue<P> QP;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
inline int in() { int x; scanf("%d",&x); return x;}
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
const int MOD = 1000000007;
#define dame { puts("-1"); return 0;}
#define yn {puts("YES");}else{puts("NO");}
  
int main() {
  int H,W;
  cin >> H >> W;
  vi az(26,0);
  rep(i,H){
    rep(j,W) {
      char c;
      cin >> c;
      az[c-'a']++;
    }
  }
  int k4=0,k2=0,odd=0;
  rep(i,26){
    if(az[i] == 0) continue;
    if(az[i]%4 == 0) {
      k4++;
    } else if(az[i]%2 == 0) {
      k2++;
    } else {
      odd++;
    }
  }
  if(odd > 1) {
    cout << "No" << endl;
    return 0;
  }
  if(odd == 1 && !(H%2 == 1 && W%2 == 1)) {
    cout << "No" << endl;
    return 0;
  }
  int cnt = H%2 * (W / 2)+ W%2 * (H / 2);
  if(cnt < k2) {
    cout << "No" << endl;
    return 0;
  }
  cout << "Yes" << endl;
  return 0;
}

Measured memory_bytes: 256
a, b ,c = map(int,input().split(" "))
ap =[]
ap = list(map(int,input().split(" ")))
bp =[]
bp = list(map(int,input().split(" ")))
lowest = 10000000
ma = min(ap)
mb = min(bp)
lowest = ma +mb
for _ in range(c):
    x, y ,z = map(int,input().split(" "))
    dis = ap[x-1] + bp[y-1] - z
    lowest = min(lowest,dis)
print(lowest)

Measured memory_bytes: 18736
#include<bits/stdc++.h>
using namespace std;
const int N = 1e6;
int n,m, k;
int main()
{
    #ifndef ONLINE_JUDGE
   // freopen("input.txt","r",stdin);
   // freopen("output.out","w",stdout);
    #endif // ONLINE_JUDGE
    cin>>n>>m;
    int sum = 0;
    for(int i = 4;i<=n;++i)
    {
         for(int j = 2;j<=m/10;++j)
         {
             if(i%j==0){
              int a = i/j;
              if(a>=2&&a<=9&&(j*10+a)<=m)   {
                sum++;
              //cout<<i" "<<
              }
             }
         }
    }
    cout<<sum<<endl;

}


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

int main() {
  int N, M;
  cin >> N >> M;
  int min_id = 1, max_id = 100000;
  for (int i = 0; i < M; i++) {
    int L, R;
    cin >> L >> R;
    min_id = max(min_id, L);
    max_id = min(max_id, R);
  }

  cout << max(0, max_id - min_id + 1) << endl;
  return 0;
}

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

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

#define rep(i,cc,n) for(int i=cc;i<n;++i)
#define lrep(i,cc,n) for(long long i=cc;i<n;++i)
#define sqrep(i,cc,n) for(long long i=cc;i*i<=n;++i)
#define rrep(i,cc,n) for(long i=cc;i>n;--i)
#define pii pair<int, int>
#define pll pair<long long, long long>
 
using ll = long long;

const vector<int> dx = {1, 0, -1, 0};
const vector<int> dy = {0, 1, 0, -1};
const ll inf = 1001001001;
const ll e9  = 1000000000;
const ll mod = 1000000007;

int main() {
    int n;
    cin >> n;
    ll m=0, a=0, r=0, c=0, h=0;
    rep(i, 0, n){
        string s;
        cin >> s;
        if(s[0]=='M')m++;
        if(s[0]=='A')a++;
        if(s[0]=='R')r++;
        if(s[0]=='C')c++;
        if(s[0]=='H')h++;
    }
    ll ans = m*a*r + m*a*c + m*a*h + m*r*c + m*r*h
    + m*c*h + a*r*c + a*r*h + a*c*h + r*c*h;
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <map>
#include <cstdio>
#include <cmath>
#define REP(i, a, n) for(int i = (a); i < (n); i++)
using namespace std;
typedef pair<int, int> pii;

int r, n, xl, xr, h;

int main(void) {
  while(cin >> r >> n, r) {
    map<pii, bool> m;
    int mh = 0;
    REP(i, 0, n) {
      cin >> xl >> xr >> h;
      REP(j, 0, h) REP(k, xl, xr) m[pii(j, k)] = true;
      mh = max(mh, h);
    }

    // REP(i, 0, mh) {
    //   REP(j, -r, r) {
    //     cout << (m[pii(i, j)] ? 1 : 0);
    //   }
    //   cout << endl;
    // }
    // cout << endl;

    double t = 1000;
    REP(i, 0, mh + 1) {
      REP(j, -r, r) {
        if(!m[pii(i, j)]) {
          int y = i;
          int x = j < 0 ? -(j + 1) : j;
          t = min(t, y - sqrt(r * r - x * x) + r);
        }
      }
    }
    printf("%.4f\n", max(0.0, t));
  }

  return 0;
}

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

#define pb push_back
#define F first
#define S second
#define y1 dasdasfasfas
#define x1 wqdadfasfasfas
#define All(c) c.begin(), c.end()
#define SZ(A) (int((A).size()))
#define umap unordered_map
#define __ fflush(stdout)
#define FILENAME ""

typedef long long ll;
typedef long double ld;    

using namespace std;

void FREOPEN() {
	#ifdef LOCAL
		freopen(".in", "r", stdin);
		freopen("1.out", "w", stdout);
	#else
		//freopen(FILENAME".in", "r", stdin);
		//freopen(FILENAME".out", "w", stdout);
	#endif
}

inline double Time() {return (clock() * 1.0) / CLOCKS_PER_SEC; }             

const int N = 200500, inf = 1e9 * 2;

const ll MOD = 1e9 + 7ll, INF = 1e18;

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

int main() {
	FREOPEN();
	int a, b;
	cin >> a >> b;
	if (b % a == 0) cout << a + b;
	else cout << b - a;
	return 0;
}


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

void solve()
{
    string s;
    cin >> s;
    string ans = "";
    rep(i, s.size())
    {
        if (s[i] == '0')
        {
            ans += "0";
        }
        else if (s[i] == '1')
        {
            ans += "1";
        }
        else
        {
            if (!ans.empty())
            {
                // int b = ans.size() - 1;
                // ans.erase(b);
                ans = ans.substr(0, ans.size() - 1);
            }
        }
    }
    cout << ans << endl;
}

int main()
{
    solve();
    return 0;
}

Measured memory_bytes: 3596
import java.io.BufferedReader;
import java.io.Closeable;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.Map.Entry;
import java.util.StringTokenizer;

public class Main {
	
	public static void main(String[] args) throws IOException {
		try(final Scanner sc = new Scanner(System.in)){
			final int P = sc.nextInt();
			final int Q = sc.nextInt();
			final int R = sc.nextInt();
			
			final int SUM = P + Q + R;
			
			System.out.println(SUM - Math.max(Math.max(P, Q), R));
		}
	}

	public static class Scanner implements Closeable {
		private BufferedReader br;
		private StringTokenizer tok;

		public Scanner(InputStream is) throws IOException {
			br = new BufferedReader(new InputStreamReader(is));
		}

		private void getLine() throws IOException {
			while(!hasNext()){
				tok = new StringTokenizer(br.readLine());
			}
		}

		private boolean hasNext() {
			return tok != null && tok.hasMoreTokens();
		}

		public String next() throws IOException {
			getLine();
			return tok.nextToken();
		}

		public int nextInt() throws IOException {
			return Integer.parseInt(next());
		}

		public long nextLong() throws IOException {
			return Long.parseLong(next());
		}

		public double nextDouble() throws IOException {
			return Double.parseDouble(next());
		}

		public int[] nextIntArray(int n) throws IOException {
			final int[] ret = new int[n];
			for(int i = 0; i < n; i++){
				ret[i] = this.nextInt();
			}
			return ret;
		}

		public long[] nextLongArray(int n) throws IOException {
			final long[] ret = new long[n];
			for(int i = 0; i < n; i++){
				ret[i] = this.nextLong();
			}
			return ret;
		}

		public void close() throws IOException {
			br.close();
		}
	}
}

Measured memory_bytes: 20692
#include <bits/stdc++.h>
using namespace std;
bool dp[100 * 1000];
int main() {
	int n;
	cin >> n;
	dp[0] = 1;
	for (int i = 1; i <= n; i++) {
		int x;
		cin >> x;
		for (int j = 100 * 100; j >= x; j--) {
			if (dp[j - x]) {
				dp[j] = true;
			}
		}
	}
	int ans = 0;
	for (int i = 100 * 100; i >= 0; i--) {
		if (i % 10 != 0 && dp[i]) {
			cout << i;
			return 0;
		}
	}
	cout << 0;
	return 0;
}


Measured memory_bytes: 256
N,M=map(int,input().split())
L,R=map(int,input().split())
for i in range(M-1):
    H,I=map(int,input().split())
    if H>L:
        L=H
    if R>I:
        R=I
    if R<L:
        break
if R<L:
    print(0)
else:
    ans=list(range(L,R+1))
    print(len(ans))


Measured memory_bytes: 12540
#include <iostream>
#include <cstdio>
#include <vector>

using namespace std;

#define ull unsigned long long

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

int main(){
    int N;
    cin >> N;
    ull t;
    ull mul = 1;
    for(int i=0; i<N; i++){
        cin >> t;
        ull g = gcd(mul, t);
        //ull g = mul;
        //ull tmp = t;
        //while(g != tmp){
        //    if(g == 1 || tmp == 1){
        //        g = 1;
        //        break;
        //    } 
        //    if(g > tmp){
        //        if(g % tmp == 0){
        //            g = tmp;
        //            break;
        //        }
        //        g -= tmp;
        //    }
        //    else{
        //        if(tmp % g == 0) break;
        //        tmp -= g;
        //    }
        //}
        //printf("g : %lld    tmp : %lld   t : %lld\n",g, tmp, t);
        mul = g * (mul/g) * (t/g); 
    }
    cout << mul << endl;
    return 0;
}


Measured memory_bytes: 768
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vb = vector<bool>;
using vs = vector<string>;
using msi = map<string, int>;
using mii = map<int, int>;
using psi = pair<string, int>;
using pii = pair<int, int>;
using vlai = valarray<int>;
#define rep(i,n) for(int i=0;i<n;i++)
#define range(i,s,n) for(int i=s;i<n;i++)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define fs first
#define sc second
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define INF 1E9
#define LINF 1E18*5
#define EPS 1E-9
#define MOD 1000000007
#define PI 3.1415926535897932384

template<class S, class T>ostream& operator<<(ostream&os, pair<S, T>p) { os << "[" << p.first << ", " << p.second << "]"; return os; };
template<class S>auto&operator<<(ostream&os, vector<S>t) { bool a = 1; for (auto s : t) { os << (a ? "" : " ") << s; a = 0; } return os; }

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

int main() {
	string s, t;
	cin >> s >> t;
	vi ms('z' - 'a' + 1), mt('z' - 'a' + 1);
	vi sa, ta;
	int count = 1;
	rep(i, s.size()) {
		if (ms['z' - s[i]] == 0) {
			ms['z' - s[i]] = count;
			sa.push_back(count);
			count++;
		}
		else sa.push_back(ms['z' - s[i]]);
	}
	count = 1;
	rep(i, t.size()) {
		if (mt['z' - t[i]] == 0) {
			mt['z' - t[i]] = count;
			ta.push_back(count);
			count++;
		}
		else ta.push_back(mt['z' - t[i]]);
	}
	bool ans = true;
	rep(i, sa.size()) {
		if (sa[i] != ta[i])ans = false;
	}
	cout << (ans?"Yes":"No") << endl;
}


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

// Shrotening
#define fst first
#define snd second
#define pb push_back

// Loop
#define FOR(i,a,b) for(auto i=(a);i<(b);++i)
#define RFOR(i,a,b) for(auto i=(a);i>=(b);--i)

#define REP(i,a) for(long i=0;i<(a);++i)
#define RREP(i,a) for(long i=(a);i>=0;--i)

#define EACH(i,a) for(auto (i)=(a).begin(),_END=(a).end();i!=_END;++i)
#define REACH(i,a) for(auto (i)=(a).rbegin(),_END=(a).rend();i!=_END;++i)

//Algorithm
#define ALL(a) (a).begin(), a.end()
#define RALL(a) (a).rbegin(), a.rend()
#define EXIST(a,x) ((a).find(x)!=(a).end())
#define SORT(a) std::sort((a).begin(), (a).end())
#define UNIQUE(a) std::sort((a).begin(), a.end()), a.erase(std::unique((a).begin(), a.end()), a.end());
#define SUM(a) std::accumulate((a).begin(), (a).end(), 0);

//Setting
#define OPT std::cin.tie(0);std::ios::sync_with_stdio(false);

//debug message
bool debug = true;
#define MSG(s)   if(debug){std::cout << s << std::endl;}
#define DEBUG(x) if(debug){std::cout << "debug(" << #x << "): " << x << std::endl;}

//alias
typedef long long LL;
typedef std::vector<char> VC;
typedef std::vector<int>  VI;
typedef std::vector<long> VL;
typedef std::vector<long long> VLL;

typedef std::vector< VC > VC2;
typedef std::vector< VI > VI2;
typedef std::vector< VL > VL2;
typedef std::vector< VLL > VLL2;

typedef std::pair<int,int> PII;

int N;
std::string S;
int main() {
    std::cin >> N;
    std::cin >> S;

    int num_W = 0, num_E = 0;
    for(char c: S) {
        if(c == 'W') {
            ++num_W;
        } else {
            ++num_E;
        }
    }

    int num_W2 = 0, num_E2 = 0;
    int min = 3 * 1e5;

    for(int i=0; i<N; ++i) {
        char c = S[i];
        if(c == 'W') {
            ++num_W2; 
        } else {
            ++num_E2;
        }

        if(i == 0) {
            int x = num_E - (c == 'E');
            min = std::min(min, x);
        } else if(i == N-1) {
            int x = num_W2 - (c == 'W');
            min = std::min(min, x);
        } else {
            int left = num_W2 - (c == 'W');
            int right = num_E - num_E2 + (c == 'E');
            min = std::min(min, left + right);
        }


    }
    std::cout << min << std::endl;
}

Measured memory_bytes: 900
import java.util.*;

public class Main{
  public static void main(String[]args){
    Scanner sc=new Scanner(System.in);
    int a=sc.nextInt();
    int b=sc.nextInt();
    int c=sc.nextInt();
    if(c>=a &&c<=b){
      System.out.println("Yes");
    }else{
      System.out.println("No");
    }
  
  }
}

Measured memory_bytes: 21716
#include<bits/stdc++.h>
#define ll long long
#define re register
#define ull unsigned int
using namespace std;
inline int read(){
	int s=0,t=1;
	char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')t=-1;ch=getchar();}
	while(ch>='0'&&ch<='9')s=(s<<3)+(s<<1)+(ch^48),ch=getchar();
	return s*t;
}
const int N=105;
int n,m,K,P,o;
int coe[N],C[N][N],p[N][N],f[2][N][N],tp[N][N];
int Mod(int x){return x>=P?x-P:x;}
void Pre(int n){
	coe[0]=1;for(int i=1;i<=n;i++)coe[i]=P-coe[i-1];
	for(int i=0;i<=n;i++){
		C[i][0]=p[i][0]=1;
		for(int j=1;j<=n;j++)p[i][j]=1ll*p[i][j-1]*i%P;
		for(int j=1;j<=i;j++)C[i][j]=Mod(C[i-1][j-1]+C[i-1][j]);
	}
}
void Clear(int t){
	for(int i=0;i<=n;i++)
	for(int j=0;j<=m;j++)f[t][i][j]=0;
}
int main(){
//	freopen(".in","r",stdin);
//	freopen(".out","w",stdout);
	n=read(),m=read(),K=read(),P=read(),Pre(100);
	f[0][0][0]=1;
	for(int t=1;t<=K;t++){
		o^=1,Clear(o);
		for(int i=0;i<=n;i++)for(int j=0;j<=m;j++)if(f[o^1][i][j]){
			int x=1ll*p[K-t+1][j]*p[t][m-j]%P,y=f[o^1][i][j];
			for(int a=0;a+i<=n;a++,y=1ll*y*x%P)f[o][i+a][j]=Mod(f[o][i+a][j]+1ll*C[n-i][a]%P*y%P);
		}o^=1,Clear(o);
		for(int i=0;i<=n;i++)for(int j=0;j<=m;j++)if(f[o^1][i][j]){
			int x=1ll*p[K-t+1][i]*p[t][n-i]%P,y=f[o^1][i][j];
			for(int b=0;b+j<=m;b++,y=1ll*y*x%P)f[o][i][j+b]=Mod(f[o][i][j+b]+1ll*C[m-j][b]%P*y%P);
		}o^=1,Clear(o);
		for(int i=0;i<=n;i++)for(int j=0;j<=m;j++)if(f[o^1][i][j]){
			int x=1ll*(P-p[K-t][j])*p[t][m-j]%P,y=f[o^1][i][j];
			for(int a=0;a+i<=n;a++,y=1ll*y*x%P)f[o][i+a][j]=Mod(f[o][i+a][j]+1ll*C[n-i][a]%P*y%P);
		}o^=1,Clear(o);	
		for(int i=0;i<=n;i++)for(int j=0;j<=m;j++)if(f[o^1][i][j]){
			int x=1ll*(P-p[K-t][i])*p[t][n-i]%P,y=f[o^1][i][j];
			for(int b=0;b+j<=m;b++,y=1ll*y*x%P)f[o][i][j+b]=Mod(f[o][i][j+b]+1ll*C[m-j][b]%P*y%P);
		}
	}printf("%d",f[o][n][m]);
	return 0;
}
/*2 2 2 998244353*/


Measured memory_bytes: 3908
#include<stdio.h>

int A[1000000], n;

int binarySearch(int key){
    int left = 0;
    int right = n;
    int mid;

    while(left < right){
        mid = (left + right) / 2;
        if( key == A[mid] ) return 1;
        if( key > A[mid] ) left = mid + 1;
        else if( key < A[mid] ) right = mid;
    }
    return 0;
}

int main(void){
    int i, q, k,sum = 0;

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

    scanf("%d", &q);
    for(i = 0; i < q; i++){
        scanf("%d", &k);
        if(binarySearch( k ) ) sum++;
    }
    printf("%d\n", sum);
    return 0;
}



Measured memory_bytes: 2116
#include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
int main() {
    const int MAX_N = 500, MAX_M = 200000, MAX_Q = 100000;
    int N, M, Q, L[MAX_M + 1], R[MAX_M + 1];
    int X[MAX_N + 1][MAX_N + 1] = {0}, C[MAX_N + 1][MAX_N + 1] = {0};
    cin >> N >> M >> Q;
    for (int i = 1; i <= M; ++i) {
        cin >> L[i] >> R[i];
        X[L[i]][R[i]]++;
    }
    for (int i = 1; i <= N; ++i) {
        for (int j = 1; j <= N; ++j) {
            C[i][j] = C[i][j - 1] + X[i][j];
        }
    }
    int p, q;
    for (int i = 1; i <= Q; ++i) {
        cin >> p >> q;
        int res = 0;
        for (int j = p; j <= q; ++j) {
            res += C[j][q] - C[j][p - 1];
        }
        cout << res << endl;
    }
    return 0;
}


Measured memory_bytes: 4480
#include <bits/stdc++.h>
#define rep(i,n) for (long long i = 0; i < (n); ++i)
const int INF = 2147483647;//int max
const long long int MOD = 1000000007;
using namespace std;
using ll = long long;
using P = pair<int,int>;
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; }

int selectionsort(vector<int> &a){
    int cnt = 0;
    rep(i,a.size()){
        int minj = i;
        for(int j = i;j<a.size();j++){
            if(a[j] < a[minj]){
                minj = j;
            }
        }
        if(i != minj)cnt++;
        swap(a[i],a[minj]);
    }
    return cnt;
}

//ミョ(-ω- ?)
int main() {
    int n;
    cin >> n;
    vector<int> a(n,0);
    rep(i,n)cin >> a.at(i);
    int res = selectionsort(a);
    rep(i,n) cout << (i ? " " : "") << a[i];
    cout << "\n" << res << endl;
    return 0;
}


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

ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
constexpr int mod = 1e9 + 7;

struct mint {
  ll x; // typedef long long ll;
  mint(ll x = 0) : x((x % mod + mod) % mod) {}
  mint operator-() const { return mint(-x); }
  mint &operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint &operator-=(const mint a) {
    if ((x += mod - a.x) >= mod) x -= mod;
    return *this;
  }
  mint &operator*=(const mint a) {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const {
    mint res(*this);
    return res += a;
  }
  mint operator-(const mint a) const {
    mint res(*this);
    return res -= a;
  }
  mint operator*(const mint a) const {
    mint res(*this);
    return res *= a;
  }
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t >> 1);
    a *= a;
    if (t & 1) a *= *this;
    return a;
  }
  mint inv() const { return pow(mod - 2); }
  mint &operator/=(const mint a) { return (*this) *= a.inv(); }
  mint operator/(const mint a) const {
    mint res(*this);
    return res /= a;
  }
  friend ostream &operator<<(ostream &os, const mint &a) { return (os << a.x); }
};
struct combination {
  vector<mint> fact, ifact;
  combination(int n) : fact(n + 1), ifact(n + 1) {
    assert(n < mod);
    fact[0] = 1;
    for (int i = 1; i <= n; ++i) fact[i] = fact[i - 1] * i;
    ifact[n] = fact[n].inv();
    for (int i = n; i >= 1; --i) ifact[i - 1] = ifact[i] * i;
  }
  mint operator()(int n, int k) {
    if (k < 0 || k > n) return 0;
    return fact[n] * ifact[k] * ifact[n - k];
  }
};

int main() {
  int num;

  int n;
  cin >> n;

  string s;
  cin >> s;

  num = 0;
  for (int i = 0; i + 2 < n; ++i) {
    if (s.substr(i, 3) == "ABC") ++num;
  }

  cout << num << endl;
}


Measured memory_bytes: 256
module.exports=function(e){var r={};function t(n){if(r[n])return r[n].exports;var o=r[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,t),o.l=!0,o.exports}return t.m=e,t.c=r,t.d=function(e,r,n){t.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:n})},t.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},t.t=function(e,r){if(1&r&&(e=t(e)),8&r)return e;if(4&r&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(t.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&r&&"string"!=typeof e)for(var o in e)t.d(n,o,function(r){return e[r]}.bind(null,o));return n},t.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(r,"a",r),r},t.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},t.p="",t(t.s=0)}([function(e,r,t){t(1)(t(2).readFileSync("/dev/stdin","UTF-8"))},function(e,r){e.exports=function(e){var r=e.split("\n"),t=Number(r[0]),n=r[1].split(" ").map(function(e){return Number(e)}),o=new Array(t).fill(0);o[1]=Math.abs(n[1]-n[0]);for(var u=2;u<t;u++){var i=o[u-1]+Math.abs(n[u-1]-n[u]),a=o[u-2]+Math.abs(n[u-2]-n[u]);o[u]=Math.min(i,a)}var f=o[t-1];console.log(f)}},function(e,r){e.exports=require("fs")}]);

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

#define ll long long int
#define fast ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define mp make_pair
#define pb push_back
#define count_bits __builtin_popcount

const int N = 1e5+7;

ll dp[101][N];

int main(){
		fast;
		ll n  , w;
		cin >> n >> w;
		ll val[n + 1] , wt[n + 1];

		for(int i = 1 ; i <= n ; i ++){
			cin >> wt[i] >> val[i];
		}

		for(int i = 1 ; i <= n ; i++)
			for(int j = 1; j <= w ;j++){
				if(wt[i] > j)
					dp[i][j] = dp[i-1][j];
				else{
					dp[i][j] = max(val[i] + dp[i-1][j - wt[i]] , dp[i-1][j]);
				}
			}

			cout << dp[n][w];

}

Measured memory_bytes: 81704
use proconio::{input, fastout};
use proconio::marker::{Chars};
use proconio::marker::Usize1;
use std::cmp::*;

macro_rules! debug {
      ($($a:expr),*) => {
          eprintln!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);
    }
}

#[fastout]
fn main() {
    input!{
        a: usize,
        op: char,
        b: usize,
    }

    if op=='+' {
        println!("{}", a+b);
    } else if op=='-' {
        println!("{}", a as i64 - b as i64);
    } else {
        return;
    }

}

Measured memory_bytes: 2188
# AtCoder Beginner Contest 126
# https://atcoder.jp/contests/abc126
import sys
#import numpy as np

s2nn = lambda s: [int(c) for c in s.split(' ')]
ss2nn = lambda ss: [int(s) for s in ss]
ss2nnn = lambda ss: [s2nn(s) for s in ss]
i2s = lambda: sys.stdin.readline().rstrip()
i2n = lambda: int(i2s())
i2nn = lambda: s2nn(i2s())
ii2ss = lambda n: [sys.stdin.readline().rstrip() for _ in range(n)]
ii2nn = lambda n: ss2nn(ii2ss(n))
ii2nnn = lambda n: ss2nnn(ii2ss(n))

def main():
    N, M = i2nn()
    XYZ = ii2nnn(M)
    G = [[] for _ in range(N)]
    for x, y, z in XYZ:
        G[x-1].append(y-1)
        G[y-1].append(x-1)
    S = set()
    c = 0
    for i in range(N):
        if i in S:
            continue
        c += 1
        S.add(i)
        q = [i]
        while len(q) > 0:
            j = q.pop()
            for k in G[j]:
                if k in S:
                    continue
                S.add(k)
                q.append(k)
    print(c)

main()


Measured memory_bytes: 92764
#include<stdio.h>

int main(void)
{
 	int a, b, c;
 
	scanf("%d %d %d", &a, &b, &c);
	
	
	if(a <= b && a <= c && b <= c){
		printf("%d %d %d\n", a, b, c);
	}
	else if(a <= b && a<= c && c <= b){
		printf("%d %d %d\n", a, c, b);
	}
	else if(b <= a && b <= c && a <= c){
		printf("%d %d %d\n", b, a, c);
	}
	else if(b <= a && b <= c && c <= a){
		printf("%d %d %d\n", b, c, a);
	}
	else if(c <= b && c <= a && a <= b){
		printf("%d %d %d\n", c, a, b);
	}
	else if(c <= b && c <= a && b <= a){
		printf("%d %d %d\n", c, b, a);
	}
   
	return 0;
   
}

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

namespace AtCoder.ABC._123
{
    class A
    {
        public static void Solve()
        {
            int[] pos = new int[5];
            int k;
            for(int i = 0; i < 5; i++)
            {
                pos[i] = int.Parse(Console.ReadLine());
            }
            k = int.Parse(Console.ReadLine());

            for(int i = 0; i < 4; i++)
            {
                for(int j = i+1; j < 5; j++)
                {
                    if(pos[j] - pos[i] > k)
                    {
                        Console.WriteLine(":(");
                        return;
                    }
                }
            }
            Console.WriteLine("Yay!");
        }
    }
  class Program
{
    static void Main(string[] args)
    {
        A.Solve();
    }
}

}


Measured memory_bytes: 11092
#include<bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
const long double PI = acos(-1);
typedef long long int ll;
typedef unsigned long long ull;
#define pb push_back
#define mp make_pair
#define all(x) x.begin(),x.end()
#define fo(i,n) for(int i=0;i<(int)n;i++)
#define fo1(i,n) for(int i=1;i<=(int)n;i++)
#define deb(x) cout<<#x<<"="<<x<<endl

void solve(int tc)
{
    int x, y, d, c = 0;
    cin >> x >> y >> d;
    for(; x <= y; x++) if(x % d == 0)c++;
    cout << c << endl;
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int tc = 1;
    fo1(t, tc)
    {
        solve(t);
    }
    return 0;
}

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

int main(){
  string s;
  cin >> s;
  
  for(int i=0;i<s.length();i++){
    //奇数番目
    if(i%2==0){
      if(s[i]=='L'){
        cout << "No";
        return 0;
    }}
    else{
      if(s[i]=='R'){
        cout << "No";
        return 0;
    }}
  }
  cout << "Yes";
  
  return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

//3つの整数a,b,cにおいて、a <b <c の場合「Yes」、それ以外で「No」を出力する
int main(void){

    int a = 0, b = 0, c = 0;

	scanf("%d %d %d",&a,&b,&c);     //1つずつスペースを空ける

    //0 ≤ a, b, c ≤ 100 の条件から外れている場合無効
    if(a < 0 || a > 100 || b < 0 || b > 100 || c < 0 || c > 100){
        printf("Input Error\n");
        return 0;
    }

	if(a < b && b < c){              //問題で定義された条件
		printf("Yes\n");
    }    
	else{
		printf("No\n");
	}

    return 0;
}


Measured memory_bytes: 2044
#include<iostream>
using namespace std;
int main(){
	int x;
	int y;
	int z;
	int a;
	int b;
	cin >> x >> y>>z>>a>>b;
	if (x<z+b){
		cout << "No\n";
	}
	else if(0>z-b){
		cout << "No\n";
	}else if (y<a + b){
		cout << "No\n";
	}
	else if (0>a- b){
		cout << "No\n";
	}
	else {
		cout << "Yes\n";
	}
	return 0;
}

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

using namespace std ;

const int inf = 1e9 ;
const int MAX = 1000 + 10 ;

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

string s ;
int n , m ;

char arr[MAX][MAX] ;

int dist[MAX][MAX] ;

void bfs(int x , int y)
{
	for(int i = 0 ; i < n ; ++i)
	{
		for(int j = 0 ; j < m ; ++j)
			dist[i][j] = inf ;
	}
	deque< array<int , 3> >q ;
	dist[x][y] = 0 ;
	q.push_front({x , y , 0}) ;
	while(!q.empty())
	{
		array<int , 3>p  = q.front() ;
		q.pop_front() ;
		int x = p[0] , y = p[1] , cost = p[2] ;
		if(dist[x][y] != cost)
			continue ;
		for(int k = 0 ; k < 4 ; ++k)
		{
			int x2 = x + dx[k] ;
			int y2 = y + dy[k] ;
			if(x2 < 0 || x2 >= n || y2 < 0 || y2 >= m)
				continue ;
			if(arr[x2][y2] == '#')
				continue ;
			if(dist[x][y] < dist[x2][y2])
			{
				dist[x2][y2] = dist[x][y] ;
				q.push_front({x2 , y2 , dist[x2][y2]}) ;
			}
		}
		for(int i = -2 ; i <= 2 ; ++i)
		{
			for(int j = -2 ; j <= 2 ; ++j)
			{
				int x2 = x + i ;
				int y2 = y + j ;
				if(x2 < 0 || x2 >= n || y2 < 0 || y2 >= m)
					continue ;
				if(arr[x2][y2] == '#')
					continue ;
				if(dist[x][y] + 1 < dist[x2][y2])
				{
					dist[x2][y2] = dist[x][y] + 1 ;
					q.push_back({x2 , y2 , dist[x2][y2]}) ;
				}
			}
		}
	}
}

int x , y ;
int x2 , y2 ;


int main()
{
	ios_base::sync_with_stdio(0) ;
	cin.tie(0) ;
	cin>>n>>m ;
	cin>>x>>y ;
	cin>>x2>>y2 ;
	--x , --y ;
	--x2 , --y2 ;
	for(int i = 0 ; i < n ; ++i)
	{
		for(int j = 0 ; j < m ; ++j)
			cin>>arr[i][j] ;
	}
	bfs(x , y) ;
	if(dist[x2][y2] == inf)
		dist[x2][y2] = -1 ;
	return cout<<dist[x2][y2]<<"\n" , 0 ;
}

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

using namespace std;

typedef long long ll;
const int maxn = (int)1e5 + 1;


int n;
int a, b, c;
vector < pair < int , int > > g[maxn];
int ans[maxn], ds;
void dfs(int v, int p){
    for(pair < int , int > i : g[v]){
        if(i.first == p){
            continue;
        }
        ds += (i.second % 2);
        ans[i.first] = ds % 2;
        dfs(i.first, v);
        ds -= (i.second % 2);
    }
}

int main(){
    cin >> n;
    for(int i = 1; i < n; i++){
        cin >> a >> b >> c;
        g[a].push_back({b, c});
        g[b].push_back({a, c});
    }
    dfs(1, 1);
    for(int i = 1; i <= n; i++){
        cout << ans[i] << "\n" ;
    }
}


Measured memory_bytes: 8320
import heapq

N, M = map(int, input().split())
A = list(map(lambda x: int(x) * (-1), input().split()))

heapq.heapify(A)

for _ in range(M):
    t = -heapq.heappop(A) // 2
    heapq.heappush(A, -t)

print(-sum(A))




Measured memory_bytes: 14180
#include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define mp make_pair
using namespace std;
const int MOD = 1000000007;
const ll INF = 1LL << 60;
int main() {
   cin.tie(0);
   ios::sync_with_stdio(false);
   int n, m;
   cin >> n >> m;
   int sum = 0;
   vector<int> a(m);
   for(int i = 0;i < m;i++) {
       cin >> a[i];
       sum+=a[i];
   }
   if(sum<=n) {
       cout << n-sum << endl;
   } else {
       cout << -1 << endl;
   }
} 

Measured memory_bytes: 3684
#include<bits/stdc++.h>
using namespace std;
int main(){
	int t=1;
	//cin >> t;
	while(t--){
		int i=0,arr[5],z=0,ans=0;
      	for(i=0;i<5;i++){
        	cin >> z;
          	if(z==0){ans=i+1;}
        }
      cout << ans << endl;
	}
}

Measured memory_bytes: 3628
#include<stdio.h>

int main(){
  int pc,i,j,t,an,cu,cd,prev,now,as[100];
  scanf("%d",&pc);
  for(i=0;i<pc;i++){
    scanf("%d",&t);
    cu=cd=0;
    if(t==1){
      printf("0 0\n");
      continue;
    }
    scanf("%d",as);
    for(j=1;j<t;j++) scanf(" %d",as+j);
    for(j=1;j<t;j++){
      an=as[j]-as[j-1];
      if(an>0&&an>cu){
	cu=an;
      }else if(an<0&&-an>cd){
	cd=-an;
      }
    }
    printf("%d %d\n",cu,cd);
  }
  return 0;
}

Measured memory_bytes: 0
s = input()
a = 0
b = 0
c = 0
for i in range(len(s)):
	if s[i] == "a":
		a += 1
	elif s[i] == "b":
		b += 1
	else:
		c += 1

if max(a, b, c) - min(a, b, c) <= 1:
	print("YES")
else:
	print("NO")

Measured memory_bytes: 3188
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<cmath>
#include<cstdio>
#include<queue>
#include<deque>
#include<map>
using namespace std;
typedef pair<int,int> ii;
typedef long long ll;
typedef pair<ll,ll> pll;
const int INF=1e9;
const ll MOD=1e9+7;

ll gcd(ll x,ll y){
    if(y==0) return 0;
    return gcd(y,x%y);
}

int dis2(int x1,int y1,int x2,int y2){
    return (x1-x2)*(x1-x2)+(y1-y2)*(y1-y2);
}

double cut(int r,int n,int i){
    double res=r*r-(r-r*(double)i/(double)n)*(r-r*(double)i/(double)n);
    return pow(res,0.5)*2;
}

int main(){
    string s;cin>>s;
    int k=(int)s.size();
    int o=0;
    for(int i=0;i<k;i++)if(s[i]=='o') o++;
    if(o+(15-k)>=8) cout<<"YES"<<endl;
    else cout<<"NO"<<endl;
    return 0;
}

Measured memory_bytes: 256
n = int(input())
a = []
b = []
for _ in range(n):
    ai, bi = map(int, input().split())
    a.append(ai)
    b.append(bi)
a.sort()
b.sort()

if n % 2 == 1:
    a_median = a[(n - 1) // 2]
    b_median = b[(n - 1) // 2]
    # print(a_median, b_median)
    ans = b_median - a_median + 1
else:
    a_median = (a[n // 2 - 1] + a[n // 2])
    b_median = (b[n // 2 - 1] + b[n // 2])
    # print(a_median, b_median)
    ans = b_median - a_median + 1
print(ans)


Measured memory_bytes: 25556
#include<bits/stdc++.h>
#define rep(i,N) for(int i=0;i<(N);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
using namespace std;
const long long MOD = 1e9 + 7;
const long long INF = 1e12;
const int inf = 1e9;
const int mod = 1e9+7;
typedef long long ll;
typedef pair<ll,int> P;
typedef set<int> S;
int main(){
    cout << fixed << setprecision(10);
    ll n;
    cin >> n;
    cout << (n*(n-1))/2 << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define vi vector <ll>
#define mii map <ll,ll>
#define vpi vector <pair <ll,ll> >
#define ll long long
#define pb push_back
#define mp make_pair
#define ff(i,a,n) for(int i=a;i<n;i++)
#define vvi(n,m) vector<vi > vvi( n , vi (m));
int main() {
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
    ios::sync_with_stdio(false);
    cin.tie(0);
    string s;
    cin>>s;
    if(s=="ABC")
        cout<<"ARC";
    else
        cout<<"ABC";
    return 0;
}


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

#define pb(n) push_back(n)
#define fi first
#define se second
#define all(r) begin(r),end(r)
#define vmax(ary) *max_element(all(ary))
#define vmin(ary) *min_element(all(ary))
#define debug(x) cout<<#x<<": "<<x<<endl
#define fcout(n) cout<<fixed<<setprecision((n))
#define scout(n) cout<<setw(n)
#define vary(type,name,size,init) vector< type> name(size,init)
#define vvl(v,w,h,init) vector<vector<ll>> v(w,vector<ll>(h,init))
#define mp(a,b) make_pair(a,b)

#define rep(i,n) for(int i = 0; i < (int)(n);++i)
#define REP(i,a,b) for(int i = (a);i < (int)(b);++i)
#define repi(it,array) for(auto it = array.begin(),end = array.end(); it != end;++it)
#define repa(n,array) for(auto &n :(array))

using ll = long long;
using pii = pair<int,int> ;
using pll = pair<ll,ll> ;


int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll n;
  string u = "";
  map<char,int> m;
  map<int,char> d;
  rep(i,26){
    m['a' + i] = i;
  }
  rep(i,26){
    m['A' + i] = i + 26;
  }
  rep(i,26){
    d[i] = i +'a';
  }
  rep(i,26){
    d[26+ i] = i + 'A';
  }
  while(cin >> n,n){
    vector<ll> k(n);
    rep(i,n){
      cin >> k[i];
    } 
    string s;cin >> s;
    rep(i,s.size()){
      /* cout << (m[s[i]] - k[i % n])%52 << endl; */
      cout << d[(m[s[i]] - k[i % n]+52)%52];
    }
    cout << endl;
  }
  return 0;
}

Measured memory_bytes: 3148
H,W,A,B = map(int,input().split())

for i in range(H):
    if i < B:
        print('1'*A+'0'*(W-A))
    else:
        print('0'*A+'1'*(W-A))

# height,width,a,b = map(int,input().split())
# if a != 0 and b != 0:
#     table = [['0' for i in range(width)] for j in range(height)]
#     replacement = a*height
#     i = 0
#     j = 0
#     while replacement != 0:
#         # print('replace:',i,j)
#         table[i][j] = '1'
#         replacement -= 1
#         if replacement%a == 0:
#             # print('shift')
#             i += 1
#             # print(i)
#         j =(j+1)%width
        
#     # print('made table:',table)
#     flag = []
#     for j in range(width):
#         x = sum(int(table[i][j]) for i in range(height)) 
#         flag += [b == min(x,height-x)]
#     if all(flag):
#         for i in range(height):
#             print(''.join(table[i]))
#     else:
#         print('No')
# else:
#     if a == 0:
#         for i in range(b):
#             print('1'*width)
#         for i in range(height-b):
#             print('0'*width)
#     else:
#         for i in range(height):
#             print('1'*a+'0'*(width-a))

Measured memory_bytes: 3956
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>

int main()
{
    long N,M;
    std::cin >> N >> M;
    std::vector<long> p;
    std::vector<std::string> S;
    std::vector<long> Table(100000);
    std::vector<long> WATable(100000);
    for(long i=0 ;i<M; i++){
        std::string temp2;
        long temp;
        std::cin >> temp;
        std::cin >> temp2;
        p.push_back(temp);
        S.push_back(temp2);
    }
    long WAcount=0;
    for(long i=0; i<M; i++){
        if(S[i]=="AC" && Table[p[i]-1]==0){
            Table[p[i]-1]=1;
        }else if(S[i]=="WA" && Table[p[i]-1]==0){
            WATable[p[i]-1]++;
        }
    }
    long ACcount=0;
    for(long i=0; i<N; i++){
        ACcount+=Table[i];
        if(Table[i]==1){
            WAcount+=WATable[i];
        }
    }
    std::cout << ACcount << " " << WAcount << std::endl;
    return 0;
}

Measured memory_bytes: 8040
#include <cstdio>
#include <set>
#include <algorithm>
using namespace std;
typedef long long int64;
#define mp make_pair
const int N = (int) 4e5 + 10;

int l[N], r[N], n;

struct cmp_l {
	bool operator()(int i, int j) {
		return mp(l[i], i) > mp(l[j], j);
	}
};

struct cmp_r {
	bool operator()(int i, int j) {
		return mp(r[i], i) < mp(r[j], j);
	}
};

int main() {
	scanf("%d", &n);
	set<int, cmp_l> sl;
	set<int, cmp_r> sr;
	for (int i = 0; i < n; ++i) {
		scanf("%d%d", &l[i], &r[i]);
	}
	int64 best = 0;
	for (int dir = 0; dir < 2; ++dir) {
		int pos = 0;
		int64 ans = 0;
		for (int i = 0; i < n; ++i) {
			sl.insert(i);
			sr.insert(i);
		}
		for (int i = 0; i < n; ++i) {
			int num_l = *sl.begin();
			int num_r = *sr.begin();
			int dist_l = max(0, l[num_l] - pos);
			int dist_r = max(0, pos - r[num_r]);
			bool go_right = ((i != 0) && (dist_l > dist_r)) || ((i == 0) && (dir == 0));
			if (go_right) {
				pos += dist_l;
				ans += dist_l;
				sl.erase(num_l);
				sr.erase(num_l);
			} else {
				pos -= dist_r;
				ans += dist_r;
				sl.erase(num_r);
				sr.erase(num_r);
			}
		}
		ans += abs(pos);
		best = max(best, ans);
	}
	printf("%lld\n", best);
	return 0;
}

Measured memory_bytes: 10368
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int, int> pi;
#define debug(x) cerr << #x << ": " << x << endl;
#define debug2(x, y) debug(x) debug(y);
#define repn(i, a, b) for(int i = (int)(a); i < (int)(b); i++)
#define rep(i, a) for(int i = 0; i < (int)(a); i++)
#define all(v) v.begin(), v.end() 
#define mp make_pair
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define fi first
#define se second
#define sq(x) ((x) * (x))

template<class T> T gcd(T a, T b){ return ((b == 0) ? a : gcd(b, a % b)); }

multiset<int, greater<int>> st;
ll ans = 0;
int col[100005];
vi g[100005];

void dfs(int cur, int prev){
	col[cur] = *st.begin();
	st.erase(st.begin());
	if(prev != -1) ans += col[cur];
	for(int u : g[cur]) if(u != prev) dfs(u, cur);
}

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	//freopen("input.in", "r", stdin);
	//freopen("output.out", "w", stdout);
	int n;
	cin >> n;
	rep(i, n - 1){
		int a, b;
		cin >> a >> b;
		a--, b--;
		g[a].pb(b);
		g[b].pb(a);
	}
	vi c(n);
	rep(i, n) cin >> c[i];
	rep(i, n) st.insert(c[i]);
	dfs(0, -1);
	cout << ans << endl;
	rep(i, n) cout << col[i] << " ";
	cout << endl;
	return 0;
}
/*
Things to look out for:
	- Integer overflows
	- Array bounds
	- Special cases
Be careful!
*/


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

#define int long long

const int mod = 1e9 +7;

int Pow(int p) {
  //cout << p << endl;
  if(p == 0) return 1 % mod;
  int temp = Pow(p / 2) % mod;
  temp = ((temp % mod) * (temp % mod)) % mod;;
  //int temp = ((Pow(p / 2) % mod) * (Pow(p / 2) % mod)) % mod;
  if(p & 1) temp = ((temp % mod) * (2 % mod)) % mod;
  return temp % mod;
}

int32_t main() {
  int n; cin >> n;
  int sum1 = 0, sum2 = 0;
  for(int i = 0; i < n; ++i) {
    int a; cin >> a;
    sum1 = ((sum1 % mod) + (a % mod)) % mod;
    sum2 = ((sum2 % mod) + ((a % mod) * (a % mod)) % mod) % mod;
  }
  sum1 = ((sum1 % mod) * (sum1 % mod)) % mod;
  int ans = (((sum1 - sum2) % mod) * Pow(mod - 2) % mod) % mod;
  ans = (ans + mod) % mod;
  cout << ans;
  return 0;
}

Measured memory_bytes: 3588
#include<stdio.h>
#define N 2000000

void inNumber(int[]);
int desideK(int[]);
void countingSort(int[],int[],int);

int n=0;
int B[N];

int main(){

  int k=0,i;
  int A[N];
  A[0]=0; 
  
  scanf("%d",&n);
  inNumber(A);
  k = desideK(A); 
  countingSort(A,B,k);
  
  return 0;
}

void inNumber(int A[]){

  int i;

  for(i=1;i<=n;i++){
    scanf("%d",&A[i]);
  }  
}
int desideK(int A[]){
  int i,k=0;
  for(i=1;i<=n;i++){
    if(k<A[i]){
      k=A[i];
    }
  } 
  return k;
}
void countingSort(int A[],int B[],int k){

   int i,j;
   int C[k+1];
 
   for(i=0;i<=k;i++){
     C[i]=0;
   } 
 
   for(j=1;j<=n;j++){
     C[A[j]]++;
   }
 
   for(i=1;i<=k;i++){
     C[i]+= C[i-1];
   }

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

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

Measured memory_bytes: 16268
/** goto 文は、C/C++言語などで使うことのできる文で、実行されると無条件に指定されたラベルに処理が飛びます。
 * 例えば goto CHECK_NUM; という文が実行されると、プログラムの中で CHECK_NUM: と書かれた行に処理が移ります。
 * この機能を使って、繰り返し処理なども実現することができます。
 * 一方、goto 文は自由度が高すぎ、プログラムの可読性に影響するため、可能な限り使わないことが推奨されています。
 * 次のC++言語のプログラムと同じ動作をするプログラムを作成してください。ただし、goto 文は使わないで実装してみましょう。
 */

/*sucannerクラス使うためにインポート*/
import java.util.Scanner;

class Main {
	// プログラムのエントリポイント
	public static void main(String[] args) {
		// 入力ストリームの生成
		Scanner sc = new Scanner(System.in);
		// 処理を繰り返す
		// 数字を受け取る
		int inti = sc.nextInt();
		int[] array;
		int i = 0;
		array = new int[inti];

		for (i = 0; i < inti; i++) {
			array[i] = sc.nextInt();
			// System.out.print(array[i]);
		}
		for (; i > 0; i--) {
			System.out.print(array[i - 1]);
			if (i - 1 != 0)
				System.out.print(" ");
		}
		System.out.println();
	}
}

Measured memory_bytes: 19620