akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace __gnu_pbds;
#define ld long double
#define ull unsigned long long int
#define ll long long int
#define SPEED ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define mod 1000000007ll
#define rep(i,L,R) for(i=L;i<R;i++)
#define DEBUG
#ifdef DEBUG
#define deb2(args...) {dbg,args; cerr<<endl;}
#else
#define deb2(args...)
#endif
struct debb{template<typename T> debb& operator,(const T &v){cerr<<v<<" ";return *this;}}dbg;
#define deb1(args...) do {cerr << #args << " : "; dbg,args; cerr << "\n";} while(0)
#define printa(a,L,R) rep(i,L,R) cout << a[i] <<' ';cout<<"\n";
typedef tree<ll,null_type,less_equal<ll>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;
template<typename T>T gcd(T a,T b){if(b==0)return a;else return gcd(b,a%b);}
template<typename T>T lcm(T a,T b){return a/gcd(a,b)*b;}
ll power(ll x,ll y,ll p){ll res=1;x=x%p;while(y>0){if(y&1)res=((res%p)*(x%p))%p;y=y>>1;x=(x*x)%p;}return res;}
ll pow1(ll x,ll y){ll res=1;while(y>0){if(y&1)res=(res*x);y=y>>1;x=x*x;}return res;}
const ll INF = 1e18l+10,N = 1e5+10,MAX = 5000000;
#define sq(X) ((X)*(X))

int main()
{
    ll n,i,j,k,s=0;
    cin>>n;
    for(i=1;i<=n;i++)
    for(j=1;j<=n;j++)
    for(k=1;k<=n;k++)
    s+=gcd(gcd(i,j),k);

    cout<<s<<"\n";
}   

Measured memory_bytes: 3632
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<map>
#include<set>
#include<vector>
#include<queue>
#include<list>
#include<stack>
using namespace std;
#define ll long long 
#define dd cout<<endl
const int mod=1e9+7;
const int inf=1e9+7;
    
int main()
{
   // ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    
    int n;
    
    while(cin>>n)
    {
    	double sum=0,num;
    	for(int i=0;i<n;i++)
    	{
    		cin>>num;
    		sum+=(1.0/num);
		}
		sum=1.0/sum;
		printf("%.10f\n",sum);
	}
    
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <queue>
#include <stack>
#include <vector>
#include <stdio.h>
using namespace std;

int main(){
	int n=1,r=1;
	int i,j;
	int c,p;
	cin>>n>>r;
	while(!(n==0&&r==0)){
		int x[100];
		queue<int> q;
	
	//cout<<n<<" "<<r<<endl;
	for(i=1;i<=n;i++){
		x[i] = i;
	}
	for(i=0;i<r;i++){
		cin>>p>>c;
		for(j=0;j<c;j++){
			q.push(x[n-p+1-j]);
		}
		for(j=0;j<p-1;j++){
			q.push(x[n-j]);
		}
		for(j=0;j<p+c-1;j++){
			x[n-j]=q.front();
			//cout<<q.front()<<endl;
			q.pop();
		}
	}
	cout<<x[n]<<endl;
		/*for(i=1;i<=n;i++){
			printf("%d\n",x[i]);
		}*/
		cin>>n>>r;
	}
	return 0;
}

Measured memory_bytes: 1216
package main

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

var (
	readString func() string
	readBytes  func() []byte
	stdout     *bufio.Writer
)

func init() {
	readString, readBytes = newReadString(os.Stdin)
	stdout = bufio.NewWriter(os.Stdout)
}

func newReadString(ior io.Reader) (func() string, func() []byte) {
	r := bufio.NewScanner(ior)
	r.Buffer(make([]byte, 1024), int(1e+11))
	r.Split(bufio.ScanWords)

	f1 := func() string {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Text()
	}
	f2 := func() []byte {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Bytes()
	}
	return f1, f2
}

func readInt() int {
	return int(readInt64())
}

func readInt64() int64 {
	i, err := strconv.ParseInt(readString(), 10, 64)
	if err != nil {
		panic(err.Error())
	}
	return i
}

func readFloat64() float64 {
	f, err := strconv.ParseFloat(readString(), 64)
	if err != nil {
		panic(err.Error())
	}
	return f
}

func printf(f string, args ...interface{}) (int, error) {
	return fmt.Fprintf(stdout, f, args...)
}

func println(args ...interface{}) (int, error) {
	return fmt.Fprintln(stdout, args...)
}

func eprintln(args ...interface{}) (int, error) {
	return fmt.Fprintln(os.Stderr, args...)
}

func eprintf(f string, args ...interface{}) (int, error) {
	return fmt.Fprintf(os.Stderr, f, args...)
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func min64(a, b int64) int64 {
	if a < b {
		return a
	}
	return b
}

func max(a, b int) int {
	if a < b {
		return b
	}
	return a
}

func max64(a, b int64) int64 {
	if a < b {
		return b
	}
	return a
}

func abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}

func abs64(a int64) int64 {
	if a < 0 {
		return -a
	}
	return a
}

func gcd(a, b int) int {
	if b == 0 {
		return a
	}
	return gcd(b, a%b)
}

func gcd64(a, b int64) int64 {
	if b == 0 {
		return a
	}
	return gcd64(b, a%b)
}

// readString() string
// readInt() int
// readInt64() int64
// readFloat64() float64

// -----------------------------------------------------------------------------

func main() {
	defer stdout.Flush()
	N := readInt()
	K := readInt()
	X := readInt()
	Y := readInt()
	println(N*Y + min(K, N)*(X-Y))
}

// -----------------------------------------------------------------------------


Measured memory_bytes: 640
#include<bits/stdc++.h>
#define ALL(c) (c).begin(),(c).end()
#define EACH(i,c) for(auto i=(c).begin();i!=(c).end();++i)
using namespace std;
#define int long long


void solve(long long N, long long M, long long Q, std::vector<long long> L, std::vector<long long> R, std::vector<long long> p, std::vector<long long> q){
    vector<vector<int>> v(N + 1);
    for(int i = 0; i < M; ++i) {
        v[L[i]].push_back(R[i]);
    }
    for(int i = 1; i <= N; ++i) {
        sort(ALL(v[i]));
    }

    for(int i = 0; i < Q; ++i) {
        int res = 0;
        for(int k = p[i]; k <= q[i]; ++k) {
            res += upper_bound(ALL(v[k]), q[i]) - v[k].begin();
        }
        cout << res << endl;
    }
}

signed main(){
    long long N;
    scanf("%lld",&N);
    long long M;
    scanf("%lld",&M);
    long long Q;
    scanf("%lld",&Q);
    std::vector<long long> L(M);
    std::vector<long long> R(M);
    for(int i = 0 ; i < M ; i++){
        scanf("%lld",&L[i]);
        scanf("%lld",&R[i]);
    }
    std::vector<long long> p(Q);
    std::vector<long long> q(Q);
    for(int i = 0 ; i < Q ; i++){
        scanf("%lld",&p[i]);
        scanf("%lld",&q[i]);
    }
    solve(N, M, Q, std::move(L), std::move(R), std::move(p), std::move(q));
    return 0;
}


Measured memory_bytes: 9984
#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
using namespace std;
using ll = long long;
#define SIZE_OF_ARRAY(array) (sizeof(array)/sizeof(array[0]))
ll u18 = 1000000000000000000;
int main()
{
    
    int n, k; 
    cin >> n >> k ;
    int p[n];
    for( int i = 0; i < n; i++){
        cin >> p[i] ;
    }    
    sort( p, p+sizeof(p)/sizeof(p[0]));
    int ans=0;
    for( int i = 0; i < k; i++){
        ans+=p[i];
    }    
    cout << ans << endl;
   
    return 0;
}


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

typedef long long LL;
typedef pair<int, int> PII;
typedef vector<int> VI;
#define MP make_pair
#define PB push_back
#define X first
#define Y second

#define FOR(i, a, b) for(int i = (a); i < (b); ++i)
#define RFOR(i, b, a) for(int i = (b) - 1; i >= (a); --i)
#define ALL(a) a.begin(), a.end()
#define SZ(a) (int)((a).size())
#define FILL(a, value) memset(a, value, sizeof(a))
#define debug(a) cout << #a << " = " << a << endl;

const double PI = acos(-1.0);
const LL INF = 1e9 + 47;
const LL LINF = INF * INF;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

int main()
{
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	
	int a, b;
	cin >> a >> b;
	if (a > 9 || b > 9) cout << -1;
	else cout << a * b;
	cerr << "Time elapsed: " << clock() / (double)CLOCKS_PER_SEC << endl;
	return 0;
}



Measured memory_bytes: 256
(defun check_A (x)
  (when (and x (char= (car x) #\A))
			 (check_B (cdr x))))
(defun check_B (x)
  (when (and x (char= (car x) #\B))
			 (check_C (cdr x))))
(defun check_C (x)
  (and x (char= (car x) #\C)))

(defun cnt (x)
  (if x
	(+ (if (check_A x) 1 0) (cnt (cdr x)))
	0))

(defparameter n (read))
(let ((str (concatenate 'list (read-line))))
  (princ (cnt str)))



Measured memory_bytes: 12260
#include <iostream>
#include <cstdio>
#include <vector>
#include <string>
#include <algorithm>

#define rep(i,n) for(int i=0; i<(n); i++)
#define rrep(i,n) for(int i=(n)-1; i>=0; i--)
#define all(X) (X).begin(),(X).end()

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

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

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

const int INF = 0x3fffffff;


int main(){
	string s;

	cin >> s;

	int ans = 0;
	for(auto c: s){
		if( c == 'g' ) ans++;
		else ans--;
	}

	cout << (ans/2) << endl;

	return 0;
}


Measured memory_bytes: 512
/*
    NEVER GIVE UP!
    THE EXPERT IN ANYTHING WAS ONCE A BEGINNER
*/

#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
using namespace std;
#define FIO ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define ll long long int
#define ull unsigned long long int
#define ld long double
#define f(i,a,b) for(ll i=a; i<=b; i++)
#define fi(i,a,b) for(ll i=a; i>=b; i--)
#define fa(x,b) for(auto x:b)
#define TC ll test_case; cin>>test_case; for(ll number=1 ; number <= test_case ; number ++ )
#define vll vector<ll>
#define pb push_back
#define pll pair<ll,ll>
#define mp make_pair
#define ff first
#define ss second
#define sz(a) (ll)(a).size()
#define sp(x) cout << fixed << setprecision(x);
#define ReadFile freopen("input.txt","r",stdin)
#define WriteFile freopen("output.txt","w",stdout)
#define endl "\n"

const ld pi = acos(-1);
const ll M=1e9+7,N=1e5+5,INF=1e18;

void solve()
{
    ll a,b;
    cin >> a >> b;
    cout << 6-a-b ;
}

int32_t main()
{
    FIO
    solve();
    return 0;
}

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

int main(){
	cin.tie(0),ios::sync_with_stdio(false);
	int a,b,c; cin>>a>>b>>c;
	double S=a*b*0.5*sin(c*M_PI/180);
	double L=a+b+sqrt(a*a+b*b-2*a*b*cos(c*M_PI/180));
	double h=2*S/a;
	cout<<fixed<<setprecision(8)<<S<<" "s<<L<<" "s<<h<<"\n"s;
}


Measured memory_bytes: 3524
#include <bits/stdc++.h>
using namespace std;
#define REP(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) REP(i, 0, n)
#define rrep(i, n) for (int i = (int)(n-1); i >= 0; i--)
#define sz(x) int(x.size())
#define bitsz(x) int(__builtin_popcount(x))
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define pb(x) push_back(x)
#define INF 1e9
#define LINF 1e18
#define mod 1000000007
template<class T> inline bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T &a, const T &b) { if (a > b) { a = b; return 1; } return 0; }
template < typename T > inline string toString( const T &a ) { ostringstream oss; oss << a; return oss.str(); };
typedef long long ll;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
const int di[4] = {1,0,-1,0};
const int dj[4] = {0,1,0,-1};


int main() {
    int n; cin >> n;
    //vector<ll> a(n);
    vector<ll> num(100005,0); //バケットで管理
    ll ans = 0;
    rep(i,n) {
        ll a;
        cin >> a;
        num[a]++;
        ans += a;
    }
    int q; cin >> q;
    vector<ll> b(q), c(q);
    rep(i,q) cin >> b[i] >> c[i];

    rep(i,q) {
        ans += num[b[i]]*(c[i]-b[i]);
        num[c[i]] += num[b[i]];
        num[b[i]] = 0;
        cout << ans << endl;
    }

    // sort(all(a));
    
    // ll ans = 0;
    // rep(i,n) ans += a[i];

    // rep(i,q) {
    //     int num = upper_bound(all(a),b[i])-lower_bound(all(a),b[i]);
    //     ans += (c[i]-b[i])*num;
    //     cout << ans << endl;
    //     //値の置き換えをどうするか？O(logN)でいけるやり方あるか？
    // }

}

Measured memory_bytes: 5612
#include<bits/stdc++.h>
using namespace std;
unordered_set<string> a;
int main(){
	int n;
	cin>>n;
	string s[n];
	for(int i=0;i<n;i++)cin>>s[i];
	for(int i=1;i<6;i++){
		for(int j=0;j<n;j++){
			for(int k=0;k<s[j].size();k++){
				if(k+i<=s[j].size())a.insert(s[j].substr(k,i));
			}
		}
	}
	for(int i=0;i<27;i++)
		for(int j=0;j<27;j++)
			for(int k=0;k<27;k++)
				for(int l=0;l<26;l++){
					string t;
					if(i)t+='a'-1+i;
					if(j)t+='a'-1+j;
					if(k)t+='a'-1+k;
					t+='a'+l;
					if(!a.count(t)){
						cout<<t<<endl;
						return 0;
					}
				}
}

Measured memory_bytes: 75472
#include <iostream>
#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>
 
using namespace std;
typedef long long ll;
 
 
typedef pair<ll,ll> P;
long long int INF = 1e18;
double Pi = 3.141592653589;
const int mod = 1000000007;
// memset(a,0,sizeof(a)); →全部０にする
 
vector<ll> G[100005];
std::vector<P> tree[100010];
 
int dx[8]={1,0,-1,0,1,1,-1,-1};
int dy[8]={0,1,0,-1,1,-1,-1,1};
 
#define p(x) cout<<x<<endl;
#define el cout<<endl;
#define pe(x) cout<<x<<" ";
#define re(i,a,b) for(i=a;i<=b;i++);
#define pb push_back
 
ll i,j,k,ii,jj;
ll n,m,sum,num;
ll a,b,c,d,e,ans=1;
vector<ll> p[3];
bool dpx[100005],dpy[100005];
char s[100005];

int main(){
	cin>>s;
	for(i=0;i<6;i++)if(s[i]=='1')ans++;
	p(ans-1);
	return 0;
}

Measured memory_bytes: 4992
#include<bits/stdc++.h>
#define maxn 200010
#define ll long long
#define INF 1e18
using namespace std;
int x[maxn], n;
ll pre[maxn];
ll solve(int sum)
{
	ll res = 0;
	int cur = n, now = 1;
	res = 2 * (pre[cur] - pre[cur - sum]);
	while (cur)
	{
		now++;
		int tl = max(1, cur - sum + 1);
		ll delta = (ll)now * now - ((ll)now - 1) * (now - 1);
		if ((INF - res) / (pre[cur] - pre[tl - 1]) < delta) return INF;
		res += delta * (pre[cur] - pre[tl - 1]);
		cur = tl - 1;
	}
	return res;
}
int main()
{
	int m;
	scanf("%d%d", &n, &m);
	for (int i = 1; i <= n; i++)
	{
		scanf("%d", &x[i]);
		pre[i] = pre[i - 1] + x[i];
	}
	ll res = INF;
	for (int i = 1; i <= n; i++)
	{
		ll cur = ((ll)n + i) * m + solve(i);
		res = min(res, cur);
	}
	printf("%lld\n", res);
	return 0;
}

Measured memory_bytes: 2560
while True:
    n = int(input())
    if n == 0 :
        break
    lst = input().split()
    sum = 0

    for i in lst:
        sum = sum + int(i)

    mean = sum / len(lst)
    poor = 0

    for i in lst:
        if mean >= int(i):
            poor = poor +  1

    print(poor)


Measured memory_bytes: 6340
package main

import (
	"fmt"
	"strings"
)

func find(slice []string, val string) (int, bool) {
	for i, item := range slice {
		if item == val {
			return i, true
		}
	}
	return -1, false
}

func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

func main() {
	var s string
	fmt.Scan(&s)

	sSlice := strings.Split(s, "")
	acgt := []string{"A", "C", "G", "T"}
	result := 0

	for i := 0; i < len(sSlice); i++ {
		tmp := 0
		for j := i; j < len(sSlice); j++ {
			exist := false
			for k := 0; k < len(acgt); k++ {
				if sSlice[j] == acgt[k] {
					exist = true
				}
			}
			if exist {
				tmp = tmp + 1
				result = max(result, tmp)
			} else {
				break
			}
		}
	}
	fmt.Println(result)
}


Measured memory_bytes: 1844
#include <stdio.h>

int main(void) {

  int x;
  
    scanf("%d", &x);

  int n[2];
  n[0] = x % 100;
  n[1] = (x - n[0]) / 100;

  if (n[0] <= 12 && n[0] >= 1) {
    if (n[1] > 12 || n[1] < 1) {
      printf("YYMM\n");
    } else {
      printf("AMBIGUOUS\n");
    }
  } else {
    if (n[1] <= 12 && n[1] >= 1) {
      printf("MMYY\n");
    } else {
      printf("NA\n");
    }
  }

  return 0;
}

Measured memory_bytes: 128
N = int(input())
D = [int(d) for d in input().split()]

D.append(0)
D.sort()
ans = 0
time1 = []
time2 = []
for i in range(N+1):
    if D.count(D[i]) == 2:
        if D[i] == 0:
            ans = -1
            break
        time2.append(D[i])
        time2.append(24-D[i])
    if D.count(D[i]) + D.count(24-D[i]) > 2:
        ans = -1
        break
    if D.count(D[i]) == 1:
        time1.append(D[i])

time2 = set(time2)    
if ans == 0:
    for i in range(2**len(time1)):
        temp = []
        for j in range(len(time1)):
            if i & 1<<j:
                temp.append(24-time1[j])
            else:
                temp.append(time1[j])
        temp += list(time2)
        temp.sort()
        cnt = 24-temp[-1]
        if temp[-1] == 0:
            cnt = 0
        for k in range(len(temp)-1):
            cnt = min(cnt, temp[k+1]-temp[k])
        ans = max(ans, cnt)
else:
    ans = 0

print(ans)

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

int main() {
  int n, m;
  cin >> n >> m;
  vector<int> a(m);
  for(int i = 0;i < m;i++){
    cin >> a.at(i);
  }
  int s = 0;
  for(int i = 0;i < m;i++){
    s += a.at(i);
  }
  int ans = n - s;
  if(ans >= 0)
    cout << ans << endl;
  else
    cout << -1 << endl;
    
}


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

bool IsXBig(int x, int y)
{
	if(x >= y)
		return true;
	else 
		return false;
}

int main()
{
	int x,y;
	int gcd;
	cin >> x;
	cin >> y;

	/* ??°????°??´???? */
	while(true)
	{
		if(x % y == 0){gcd = y;break;}
		else if (y % x == 0){gcd = x;break;}

		if(IsXBig(x,y))
		{
		/* x >= y */
			x = x % y;
		} else 
		{
		/* x < y */
			y = y % x;
		}
	}

	cout << gcd << endl;

	return 0;
}

Measured memory_bytes: 1160
import java.util.*;


public class Main {
    static void solve() {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int k = sc.nextInt();

        HashMap<Integer, Integer> balls = new HashMap<>();
        for(int i = 0; i < n; i++){
            int bn = sc.nextInt();
            if(balls.containsKey(bn)){
                balls.put(bn, balls.get(bn)+1);
            }else{
                balls.put(bn, 1);
            }
        }

        List<Integer> ballsNum = new ArrayList<>(balls.values());
        Collections.sort(ballsNum);
        int sum = 0;
        for(int i = 0; i < ballsNum.size()-k; i++){
            sum += ballsNum.get(i);
        }
        System.out.println(sum);
    }

    public static void main(String[] args) {
        solve();
    }
}


Measured memory_bytes: 100152
#include <stdio.h>

int main(){
  char x;
  scanf("%c", &x);
  if (x == 'A') {
    printf("%c\n",'T');
  }
  else if (x == 'C') {
    printf("%c\n",'G');
  }
  else if (x == 'G') {
    printf("%c\n",'C');
  }
  else if (x == 'T') {
    printf("%c\n",'A');
  }
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
#pragma GCC optimize "Ofast,omit-frame-pointer,inline"
using namespace std;
typedef long long ll;

#define REP(i,n) for(int i=0; i<int(n); i++)
#define FOR(i,m,n) for(int i=int(m); i<int(n); i++)
#define ALL(obj) (obj).begin(),(obj).end()
#define VI vector<int>
#define VP vector<pair<int,int>>
#define VPP vector<pair<int,pair<int,int>>>
#define VLL vector<long long>
#define VVI vector<vector<int>>
#define VVLL vector<vector<long long>>
#define VC vector<char>
#define VS vector<string>
#define VVC vector<vector<char>>
#define VB vector<bool>
#define VVB vector<vector<bool>>
#define fore(i,a) for(auto &i:a)
typedef pair <int, int> P;
template<typename T> using min_priority_queue = priority_queue<T, vector<T>, greater<T>>;
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; }

const int  INF = (1 << 30) - 1;
const ll INFL = 1LL << 60;
const ll mod = 998244353;



int main() {

	int n, k;
	cin >> n >> k;
	VI a(n);
	REP(i, n)cin >> a[i];
	sort(ALL(a));

	int sum = 0;
	REP(i, k)sum += a[i];
	cout << sum << endl;


}

Measured memory_bytes: 3628
n, k = map(int, input().split())
mod = 998244353


LR = [list(map(int, input().split())) for _ in range(k)]

LR.sort()

memo = [0] * (n + 1)
memo[1] = 1
cummemo = [0] * (n + 1)
cummemo[1] = 1
for i in range(1, n):
    ni = i + 1
    for l, r in LR:
        # print(ni, l, r)
        if ni - l > 0:
            memo[ni] += cummemo[ni - l]
        if ni - (r + 1) > 0:
            memo[ni] -= cummemo[ni - (r + 1)]
    memo[ni] %= mod
    cummemo[ni] = cummemo[ni - 1] + memo[ni]
    cummemo[ni] %= mod
print((cummemo[n] - cummemo[n - 1]) % mod)


Measured memory_bytes: 71312
#include <iostream>
#include <algorithm>
#include <cmath>
#include <map>
#include <vector>
#include <queue>
#include <functional>
#include <string>
#include <stack>
#include <set>
#include <sstream>
#include <iomanip>
#include <limits>
#include <cstring>

using namespace std;
using ll = long long;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef pair<ll, pair<ll, ll>> PP;

const ll MOD = 1e9 + 7;
const ll MOD2 = 998244353;
const ll INF = 1 << 30;
const ll INF2 = 9e18;
const double INF3 = 9e14;
const int dx[4] = { 1,0,-1,0 }, dy[4] = { 0,1,0,-1 };
const int tx[8] = { -1,0,1,-1,1,-1,0,1 }, ty[8] = { -1,-1,-1,0,0,1,1,1 };
#define ALL(x) (x).begin(),(x).end()
#define ALLR(x) (x).rbegin(),(x).rend()
#define pb push_back
#define eb emplace_back
#define fr first
#define sc second


int main() {
	ll n, a[100010], sum = 0, p, cnt = 0;
	cin >> n;
	map<ll, ll>mp;
	for (int i = 0;i < n;i++) {
		cin >> a[i];
		sum += a[i];
	}
	if (n == 1) {
		cout << "YES" << endl;
		return 0;
	}
	if (sum % ((n + 1)*n / 2) != 0) {
		cout << "NO" << endl;
		return 0;
	}
	p = sum /( ((n + 1)*n / 2));
	for (int i = 0;i < n;i++) {
		ll sa = a[(i + 1) % n] - a[i];
		if ((ll)abs(sa - p) % n != 0) {
			cout << "NO" << endl;
			return 0;
		}
		//cout << sa << endl;
		cnt += abs(sa - p) / n;
	}
	if (cnt != p)cout << "NO" << endl;
	else cout << "YES" << endl;
	return 0;
}

Measured memory_bytes: 1024
fn main() {
    let s = std::io::stdin();
    let mut sc = Scanner { stdin: s.lock() };
    let a: u64 = sc.read();
    let b: u64 = sc.read();
    let g = gcd(a, b);

    let mut primes = vec![];
    let mut cur = g;
    for p in 2.. {
        if p * p > cur {
            break;
        }
        if cur % p == 0 {
            primes.push(p);
            while cur % p == 0 {
                cur /= p;
            }
        }
    }
    if cur > 1 {
        primes.push(cur);
    }

    println!("{}", primes.len() + 1);
}

fn gcd(a: u64, b: u64) -> u64 {
    if b == 0 {
        a
    } else {
        gcd(b, a % b)
    }
}

pub struct Scanner<R> {
    stdin: R,
}

impl<R: std::io::Read> Scanner<R> {
    pub fn read<T: std::str::FromStr>(&mut self) -> T {
        use std::io::Read;
        let buf = self
            .stdin
            .by_ref()
            .bytes()
            .map(|b| b.unwrap())
            .skip_while(|&b| b == b' ' || b == b'\n')
            .take_while(|&b| b != b' ' && b != b'\n')
            .collect::<Vec<_>>();
        unsafe { std::str::from_utf8_unchecked(&buf) }
            .parse()
            .ok()
            .expect("Parse error.")
    }
    pub fn vec<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read()).collect()
    }
    pub fn chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
}


Measured memory_bytes: 4352
#include <stdio.h>
#include <utility>
#include <string.h>

int main(void) {
  int i, j, k, n, sm = 1, now, num = 0, tmp, befnum;
  char s[200010], ans[200010];
  scanf("%s", s);
  scanf("%d", &k);
  n = strlen(s);
  for(i = 0; i <= n; ++i)ans[i] = 0;
  while(sm < n) sm *= 2;
  std::pair<char, int> seg[sm * 2];
  int seg2[sm * 2], las[sm * 2];
  int ss = 2;
  for(i = 0; i < sm * 2; ++i) {
    seg2[i] = 0;
    if(ss <= i) ss *= 2;
    las[i] = sm / (ss / 2) * (i - ss / 2 + 1);
    if(i == 1) las[i] = sm;
  }
  for(i = 0; i < sm; ++i) {
    seg[i + sm].first = s[i], seg[i + sm].second = i;
    if(i % 2) {
       now = i + sm;
       now /= 2;
       while(now) seg[now] = seg[now * 2] > seg[now * 2 + 1] ? seg[now * 2 + 1] : seg[now * 2], now /= 2;
    }
  }
  tmp = befnum = k + 1 > n ? n : k + 1;
  while(num != n && k) {
    //printf("%s %d %d %d %d\n", ans, num, tmp, befnum, k);
    i = tmp;
    if(befnum < k + 1) {for(i = tmp; i < n && befnum < k + 1; ++i) if(seg[i + sm].first != 'z' + 1) befnum++;while(seg[i + sm].first == 'z' + 1) ++i;}
    else if(befnum > k + 1) {for(i = tmp; i >= 0 && befnum > k + 1; --i) if(seg[i + sm].first != 'z' + 1) befnum--; while(seg[i + sm].first == 'z' + 1) --i;}
    tmp = i;
    std::pair<char, int> min = std::make_pair('z' + 1, 100);
    now = 1;
    while( 1 ) {
      while(las[now] > tmp) now *= 2;
      if(seg[now] < min) min = seg[now];
      if(las[now] == tmp) break;
      now++;
    }
    ans[num] = min.first;
    num++;
    int d = min.second;
    now = sm + min.second;
    seg[now].first = 'z' + 1;
    d -= seg2[now];
    now /= 2;
    while(now) d -= seg2[now], seg[now] = seg[now * 2] > seg[now * 2 + 1] ? seg[now * 2 + 1] : seg[now * 2], now /= 2;
    k -= d;
    befnum--;
    now = sm + min.second;
    while( 1 ) {
      while(!(now % 2)) now /= 2;
      seg2[now]++;
      if(las[now] == sm) break;
      now++;
    }
  }
  for(i = 0; i < n; ++i) if(seg[i + sm].first != 'z' + 1) ans[num] = s[i], num++;
  printf("%s\n", ans);
  return 0;
}


Measured memory_bytes: 11184
from collections import Counter

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

cs = [0] * (N+1)
for i in range(N):
    cs[i+1] = (cs[i] + a[i]) % M

c = Counter(cs)
ans = 0
for k in c.values():
    ans += (k * (k-1))//2
print(ans)


Measured memory_bytes: 62704
#include<stdio.h>
int main()
{
	int h,b,a=0,i;
	scanf("%d %d",&h,&b);
	int x[b];
	for(i=0;i<b;i++){
		scanf("%d",&x[i]);
		a=a+x[i];
	}
	if(a>=h){
		printf("Yes\n");
	}
	else printf("No\n");
	return 0;
}

Measured memory_bytes: 1996
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<set>
#include<map>
#include<queue>
#define REP(i,a) for (int i = 0;i < (a);++i)
#define FOR(i,a,b) for (int i = (a);i < (b); ++i)
#define FORR(i,a,b) for (int i = (a);i >= (b); --i)
#define ALL(obj) (obj).begin(),(obj).end()
#define SORT(list) sort(ALL((list)));
#define MOD 1000000007
using namespace std;
using ll = long long;
int main(){
    int n;
    ll answer = 0;
    string s;
    cin >> n >> s;

    vector<int>number_of_b(n),number_of_g(n),number_of_r(n);
    number_of_b[s.length()-1] = 0;
    if(s[s.length()-1]=='B')number_of_b[s.length()-1]++;
    number_of_g[s.length()-1] = 0;
    if(s[s.length()-1]=='G')number_of_g[s.length()-1]++;
    number_of_r[s.length()-1] = 0;
    if(s[s.length()-1]=='R')number_of_r[s.length()-1]++;

    FORR(i,s.length()-2,0){
        if(s[i]=='B'){
            number_of_b[i] = number_of_b[i+1]+1;
            number_of_g[i] = number_of_g[i+1];
            number_of_r[i] = number_of_r[i+1];
        }
        if(s[i]=='G'){
            number_of_b[i] = number_of_b[i+1];
            number_of_g[i] = number_of_g[i+1]+1;
            number_of_r[i] = number_of_r[i+1];
        }
        if(s[i]=='R'){
            number_of_b[i] = number_of_b[i+1];
            number_of_g[i] = number_of_g[i+1];
            number_of_r[i] = number_of_r[i+1]+1;
        }
    }

    REP(i,n-2){
        if(s[i]!='R')continue;
        FOR(j,i+1,n-1){
            if(s[j]!='G')continue;
            answer += (ll)number_of_b[j+1];
            int diff = j-i;
            if(j+diff < n && s[j+diff]=='B')answer--;
        }
    }
    
    REP(i,n-2){
        if(s[i]!='G')continue;
        FOR(j,i+1,n-1){
            if(s[j]!='R')continue;
            answer += (ll)number_of_b[j+1];
            int diff = j-i;
            if(j+diff < n && s[j+diff]=='B')answer--;
        }
    }
    

    REP(i,n-2){
        if(s[i]!='G')continue;
        FOR(j,i+1,n-1){
            if(s[j]!='B')continue;
            answer += (ll)number_of_r[j+1];
            int diff = j-i;
            if(j+diff < n && s[j+diff]=='R')answer--;
        }
    }
    

    REP(i,n-2){
        if(s[i]!='B')continue;
        FOR(j,i+1,n-1){
            if(s[j]!='G')continue;
            answer += (ll)number_of_r[j+1];
            int diff = j-i;
            if(j+diff < n && s[j+diff]=='R')answer--;
        }
    }
    
    REP(i,n-2){
        if(s[i]!='B')continue;
        FOR(j,i+1,n-1){
            if(s[j]!='R')continue;
            answer += (ll)number_of_g[j+1];
            int diff = j-i;
            if(j+diff < n && s[j+diff]=='G')answer--;
        }
    }
    
    REP(i,n-2){
        if(s[i]!='R')continue;
        FOR(j,i+1,n-1){
            if(s[j]!='B')continue;
            answer += (ll)number_of_g[j+1];
            int diff = j-i;
            if(j+diff < n && s[j+diff]=='G')answer--;
        }
    }
    
    cout << answer << endl;
    return 0;
}

Measured memory_bytes: 3676
#include <bits/stdc++.h>
#define FI first
#define SE second
#define PB push_back
#define ll long long
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define ROF(i,a,b) for(int i=b-1;i>=a;i--)
#define YES(i) cout<<(i?"YES":"NO")<<endl
#define Yes(i) cout<<(i?"Yes":"No")<<endl
#define co(i) cout<<(i)<<endl
#define fcout cout<<fixed<<setprecision(10)
#define uni(i) i.erase(unique(i.begin(), i.end()), i.end());
#define all(i) i.begin(),i.end()
#define pint pair<int, int>
#define vint vector<int>
using namespace std;

const int INF=1e9+7;
const int MOD=1e9+7;
//const int MOD=998244353;

int N,W;
int w[100],v[100];
ll dp[100001];

int main(){
	cin>>N>>W;
	FOR(i,0,N){
		cin>>w[i]>>v[i];
	}
	FOR(i,0,N){
		ROF(j,w[i],W+1){
			dp[j]=max(dp[j],dp[j-w[i]]+v[i]); 
		}
	}
	ll M=-INF;
	FOR(i,0,W+1){
		M=max(M,dp[i]);
	}
	co(M);
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define fi first
#define se second
#define m_p make_pair
#define p_b push_back
#define e_b emplace_back
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
using namespace std;
using ll = long long;
using ld = long double;
template<class T> bool chmax(T &a,T b){if(a<b){a=b;return true;}return false;}
template<class T> bool chmin(T &a,T b){if(a>b){a=b;return true;}return false;}

int main(){
  ios_base::sync_with_stdio(false);cin.tie(0);
  int X,N;
  cin >> X >> N;
  X+=100;
  vector<bool> exist(300,false);
  for(int i=0;i<N;i++){
    int p;
    cin >> p;
    p+=100;
    exist.at(p)=true;
  }

  if(!exist.at(X)){
    cout << X-100 << endl;
    return 0;
  }
  int l=X-1;
  int r=X+1;
  while(1){
    if(!exist.at(l)){
      cout << l-100 << endl;
      return 0;
    }
    if(!exist.at(r)){
      cout << r-100 << endl;
      return 0;
    }
    l--;
    r++;
  }

  return 0;
}

Measured memory_bytes: 3652
#include <bits/stdc++.h>
using namespace std;
using lint = long long int;
using P = pair<lint, lint>;
#define FOR(i, begin, end) for(int i=(begin),i##_end_=(end);i<i##_end_;i++)
#define IFOR(i, begin, end) for(int i=(end)-1,i##_begin_=(begin);i>=i##_begin_;i--)
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)
#define ALL(a)  (a).begin(),(a).end()
constexpr int MOD = 1000000007;
constexpr int INF = 2147483647;
void yes(bool expr) {
  cout << (expr ? "Yes" : "No") << "\n";
}
int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int N, K, Q;
  cin >> N >> K >> Q;
  vector<int> A(N);
  REP(i, N) cin >> A[i];
  int ans = INF;
  REP(k, N) {
    multiset<int> all;
    multiset<int> tmp;
    REP(i, N) {
      if(A[i] < A[k]) {
        int size = tmp.size() - K + 1;
        REP(j, size) {
          all.insert(*tmp.begin());
          tmp.erase(tmp.begin());
        }
        tmp.clear();
      } else {
        tmp.insert(A[i]);
      }
    }
    int size = tmp.size() - K + 1;
    REP(j, size) {
      all.insert(*tmp.begin());
      tmp.erase(tmp.begin());
    }
    tmp.clear();
    if(all.size() >= Q && *(next(all.begin(), Q-1)) - A[k] < ans) ans = *(next(all.begin(), Q-1)) - A[k];
    all.clear();
  }
  cout << ans << endl;
}

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

using namespace std;

int main() {
    int N;
    cin >> N;
    vector<int> ans(N, 0);

    for (int i = 0; i < N; i++) {
        int a;
        cin >> a;
        ans[a - 1] = i + 1;
    }

    for (int i : ans) {
        cout << i << " ";
    }
    cout << endl;
}

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

#define PI 3.14159265359
#define rep(i,a,n) for(int i=a;i<(int)n;++i)
#define SZ(x) ((int)(x).size())	//size() unsigned -> int
#define descsort(a) sort(a.begin(),a.end(),std::greater<int>())
using namespace std;
typedef long long ll;
const ll INF = 1e9 + 7;

int main(void)
{
    string s;
    cin>>s;
    if(s.substr(0,4)=="YAKI")cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    return 0;
}

Measured memory_bytes: 3648
#include <iostream>
#include <string>
#include <vector>
#include <array>
#include <unordered_map>
#include <algorithm>
#include <cmath>
#include <cstdint>

using namespace std;

int main()
{
    size_t N;
    cin >> N;
    vector<int> a(N);
    using bitarr = array<uint32_t, 30>;
    bitarr bits = {};
    vector<bitarr> b(a.size());
    for (uint32_t i = 0; i < N; ++i)
    {
        cin >> a[i];
        for (uint32_t k = 0; k < 30; ++k)
        {
            int x = (a[i] & 1 << k) >> k;
            b[i][k] = x;
            bits[k] += x;
        }
    }
    for (uint32_t i = 0; i < N; ++i)
    {
        int y = 0;
        for (uint32_t k = 0; k < 30; ++k)
        {
            y += ((bits[k] - b[i][k]) % 2) * (1 << k);
        }
        cout << y << " ";
    }
    return 0;
}

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

#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 ALL(obj) (obj).begin(), (obj).end()
#define INF 1e9
typedef long long ll;


int main() {
    int N; cin >> N;
    vector<vector<int>> F(N, vector<int>(10,0));
    vector<vector<int>> P(N, vector<int>(11,0));

    REP(i,N){
        REP(j,10){
            cin >> F[i][j];
        }
    }

    REP(i,N){
        REP(j,11){
            cin >> P[i][j];
        }
    }

    int ans = -INF;
    FOR(bit,1,1<<10){
        vector<int> S;
        REP(i,10){
            if(bit & (1<<i)){
                S.push_back(i);
            }
        }

        int num = 0;

        REP(i,N){
            int cnt = 0;
            for(auto s: S){
                if(F[i][s] == 1) cnt++;
            }
            num += P[i][cnt];
        }
        ans = max(ans,num);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3588
ns = input()

dp = [ [ [0]*8  for _ in range(2) ] for _ in range(len(ns)) ]
# dp[i][small_or_not][exist 7,5,3 (0~7)]

first = int(ns[0])
if first > 7:
    dp[0][1][4] = 1
    dp[0][1][2] = 1
    dp[0][1][1] = 1
elif first == 7:
    dp[0][0][4] = 1
    dp[0][1][2] = 1
    dp[0][1][1] = 1
elif first > 5:
    dp[0][1][2] = 1
    dp[0][1][1] = 1
elif first == 5:
    dp[0][0][2] = 1
    dp[0][1][1] = 1
elif first > 3:
    dp[0][1][1] = 1
elif first == 3:
    dp[0][0][1] = 1
dp[0][1][0] = 1

for i in range(0, len(ns)-1):
    next_num = int(ns[i+1])
    dp[i+1][1][0] += dp[i][1][0] 
    for e753 in range(8):
        dp[i+1][1][e753 | 4] += dp[i][1][e753] 
        dp[i+1][1][e753 | 2] += dp[i][1][e753] 
        dp[i+1][1][e753 | 1] += dp[i][1][e753] 

        if next_num > 7:
            dp[i+1][1][e753 | 4] += dp[i][0][e753] 
        if next_num > 5:
            dp[i+1][1][e753 | 2] += dp[i][0][e753] 
        if next_num > 3:
            dp[i+1][1][e753 | 1] += dp[i][0][e753]

        if next_num == 7:
            dp[i+1][0][e753 | 4] += dp[i][0][e753] 
        if next_num == 5:
            dp[i+1][0][e753 | 2] += dp[i][0][e753] 
        if next_num == 3:
            dp[i+1][0][e753 | 1] += dp[i][0][e753]

print( dp[-1][0][7] + dp[-1][1][7])

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



Measured memory_bytes: 4392
#include <bits/stdc++.h> 
using namespace std;
typedef long long ll;
typedef pair<int,int> Pint;
typedef pair<ll, ll> P;
//typedef pair<int, pair<int, int>> P;
//typedef tuple<int,int,int> T;
ll INFL = 1000000000000000010;//10^18 = 2^60
int INF = 2147483600;//10^9
ll MOD  = 1000000007;
vector<int> dy = {0,0,1,-1};
vector<int> dx = {1,-1,0,0};

int N,Q;
vector<ll> a(100010);

void que(ll S){
    int s = 0, t = 0;
    ll sum = 0;
    ll res = 0;
    for(;;){
        while(t < N){
            if(sum + a[t] <= S){
                sum += a[t++];
            }else{
                break;
            }
        }
        res += t - s;
        sum -= a[s++];
        if(s > t){
            t = s;
            sum = 0;
        }
        if(s == N) break;
    }
    cout << res << endl;
}


void solve(){
    cin >> N >> Q;
    for(int i = 0; i < N; i++) cin >> a[i];
    for(int i = 0; i < Q; i++){
        ll x;
        cin >> x;
        que(x);
    }
}

int main(void){
    solve();
}


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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define RFOR(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define REP(i,n) for(int i=0;i<(n);i++)
#define RREP(i,n) for(int i=(n)-1;i>=0;i--)
#define VSORT(v) sort(v.begin(), v.end())
#define DVSORT(v) sort(v.begin(), v.end(),greater<int>())
#define SORT(v, n) sort(v, v+n)
#define DSORT(v,n) sort(v, v+n,greater<int>())
#define vi vector<int>
#define pb push_back
#define P pair<int,int>


template <class T> void chmin(T&a, const T&b) { a = min(a,b); }
template <class T> void chmax(T&a, const T&b) { a = max(a,b); }

const double EPS =1e-9;
const long INF =999999999;
const long MOD =1000000007; //10^9+7
#define PI 3.14159265258979

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

int main(void){
	int i;
	string S;
	cin>>S;

	i=0;
	while(S[i]!='\0'){
		if(i%2==0) cout<<S[i];
		i++;
	}
	puts("");
	return 0;
}



Measured memory_bytes: 512
def main():
    import sys
    input = sys.stdin.buffer.readline
    a,b,h,m = map(int, input().split())
    import numpy as np
    theta1 = np.pi*(h/6+m/360)
    theta2 = np.pi*m/30

    theta = min(abs(theta1-theta2), 2*np.pi-abs(theta1-theta2))
    c = np.sqrt(a**2 + b**2 - 2*a*b*np.cos(theta))
    print(c)


if __name__ == '__main__':
    main()

Measured memory_bytes: 27200
def test():

	n = int(input())

	for i in range(1,n+1):
		if i % 3 == 0:
			print(f" {i}",end='')
			continue
		elif i % 10 == 3:
			print(f" {i}",end='')
			continue
		elif (i // 10) % 10 == 3:
			print(f" {i}",end='')
			continue
		elif (i // 100) % 10 == 3:
			print(f" {i}",end='')
			continue
		elif (i // 1000) % 10 == 3:
			print(f" {i}",end='')
			continue
		elif (i // 10000) % 10 == 3:
			print(f" {i}",end='')
			continue


	print()

if __name__ == "__main__":
	test()


Measured memory_bytes: 5884
#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pcc pair<char,char>
#define vi vector <int>
#define vl vector <ll>
#define sd(x) scanf("%d",&x)
#define slld(x) scanf("%lld",&x)
#define pd(x) printf("%d",x)
#define plld(x) printf("%lld",x)
#define pds(x) printf("%d ",x)
#define pllds(x) printf("%lld ",x)
#define pdn(x) printf("%d\n",x)
#define plldn(x) printf("%lld\n",x)
#define INF 2e9
#define INFLL 4e18
using namespace std;
ll powmod(ll base,ll exponent,ll mod){ // with mod < 1e9
	ll ans=1;
	while(exponent){
		if(exponent&1)ans=(ans*base)%mod;
		base=(base*base)%mod;
		exponent/=2;
	}
	return ans;
}
ll gcd(ll a, ll b){
	if(b==0) return a;
	else return gcd(b,a%b);
}
const int upperlimit = 2e5+100;
const int mod = 1e9+7;
int main() {
	int k,a,b;
	sd(k);sd(a);sd(b);
	if(a%k==0){
		printf("OK");return 0;
	}
	a/=k;b/=k;
	if(a==b) printf("NG");
	else printf("OK");
	return 0;
}

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

#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define rep(i,k,n) for (ll i = k; i < n; ++i)
#define inputar(a,n) ll a[n];rep(i,0,n)cin>>a[i]
#define PI 3.14159265
const int MOD=1e9+7;


#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define all(a)  (a).begin(),(a).end()

#define test4(x,y,z,a) cerr<<"x is "<<x<<"		y is "<<y<<"		z is "<<z<<"		a is "<<a<<endl;
#define test3(x,y,z) cerr<<"x is "<<x<<"		y is "<<y<<"		z is "<<z<<endl;
#define test2(x,y) cerr<<"x is "<<x<<"		y is "<<y<<endl;
#define test1(x) cerr<<"x is "<<x<<endl;

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

int main()
{
    IOS;
    ll a,b;
    cin>>a>>b;
    if(a==b) cout<<a+b;
    else cout<<2*max(a,b)-1<<endl;


}

Measured memory_bytes: 256
import java.util.Scanner;

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

        while(true){
            int H = sc.nextInt();
            int W = sc.nextInt();

            if(H == 0 && W == 0){
                break;
            }

            for(int i=1;i<=W;i++){
                System.out.print("#");
            }
            System.out.println();

            for(int i=1;i<=H-2;i++){
                System.out.print("#");
                for(int j=1;j<=W-2;j++){
                    System.out.print(".");
                }
                System.out.println("#");
            }

            for(int i=1;i<=W;i++){
                System.out.print("#");
            }
            System.out.println();
            System.out.println();

        }
        sc.close();

    }

}


Measured memory_bytes: 34420
#include <iostream>
#include<bits/stdc++.h>
#define all(x) (x).begin(), (x).end()

using namespace std;
using ll = long long;

long long ncr(int n, int r) {
    if(r > n - r) r = n - r; // because C(n, r) == C(n, n - r)
    long long ans = 1;
    int i;

    for(i = 1; i <= r; i++) {
        ans *= n - r + i;
        ans /= i;
    }

    return ans;
}
ll mod(ll a,ll b,ll m){
    if(b==0)return 1;
    if(b%2==0){
        ll y =  mod(a,b/2,m);
        return (y*y)%m;
    }
    else{
        return ((a%m)*mod(a,b-1,m))%m;
    }
}

ll modinv(ll a,ll m){
return mod(a,m-2,m);
//works only for prime m.
//else calculate phi(m)-1.
}



int main()
{
    int n;
    cin>>n;
    vector<ll>a(n);
    for(int i=0;i<n;i++)cin>>a[i];
    ll cur=a[0];ll tot=0;
    for(int i=1;i<n;i++){
        if(a[i-1]>a[i]){
            tot+=a[i-1]-a[i];
            a[i]=a[i-1];
        }
    }
    cout<<tot<<endl;

    return 0;
}


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

#define NREP() for(ll i = 0; i < n; i++)
#define MREP() for(ll j = 0; j < m; j++)
#define REP(i, x, y) for(ll i = x; i < y; i++)
#define ALL(x) (x).begin(), (x).end()
#define MSG(x) cout << x << endl;
#define MSGF(x, n) MSG(fixed << setprecision(n) << x)
#define END(x) cout << x << endl; return(0);
#define IPT(v, n) REP(i, 0, n){ cin >> v[i]; }
#define YN(x) x ? cout << "YES" << endl : cout << "NO" << endl;
#define Yn(x) x ? cout << "Yes" << endl : cout << "No" << endl;
#define yn(x) x ? cout << "yes" << endl : cout << "no" << endl;

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<bool> vb;
typedef vector<vector<bool>> vvb;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef vector<double> vd;
typedef vector<vector<double>> vvd;
typedef vector<char> vc;
typedef vector<vector<char>> vvc;
typedef vector<string> vs;
typedef vector<vector<string>> vvs;

const static ll MOD = 1e9 + 7;
const static ll INF = 1LL << 30;

ll a, b, c, d, k, l, m, n, h, w, q, x, y;
string s, t;

ll ans = 0;
ll sum = 0;
ll cnt = 0;
ll cur = 0;
ll tmp = 0;
ll mini = INF;
ll maxi = 0;

double ave = 0.0;

ll mod_pow(ll base, ll power) {
    if (power == 0) return 1;
    if (power == 1) return base % MOD;
    if (power % 2 == 0) return ((mod_pow(base % MOD, (power / 2)) % MOD) * (mod_pow(base, (power / 2)) % MOD)) % MOD;
    return (base % MOD * (mod_pow(base % MOD, power - 1) % MOD)) % MOD;
}

ll mod_fact(ll number) {
    ll ret = 1;
    ll count = 1;
    while (count <= number) {
        ret *= (count % MOD);
        ret %= MOD;
        count++;
    }
    return ret % MOD;
}

ll gcd(ll a, ll b) {
    if (a < b) {
        return gcd(b, a);
    }
    ll c = a % b;
    while (c != 0) {
        a = b;
        b = c;
        c = a % b;
    }
    return b;
}

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

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

string to_alpha(ll self) {
    ll n = self % 26;
    n = (n == 0) ? 26 : n;

    char c = (char) (n + 96);
    if (self == n) {
        string str = "";
        str += c;
        return str;
    }

    return to_alpha((self - n) / 26) + c;
}

int main() {
    cin >> n;
    string ans = to_alpha(n);
    MSG(ans)
}


Measured memory_bytes: 3632
#include<iostream>
#include<cstdlib>
using namespace std;

int num[50]={0};


int main(){
	int n,p;
	while(cin>>n>>p,n!=0||p!=0){
		int fin=p;
		for(int i=0;i<50;i++){
			num[i]=0;
		}
		
		int i=100;
		while(1){
			i++;
			if(i>=n){
				i=0;
			}
			if(p>0){
				num[i]++;
				p--;
			}else if(p==0){
				p+=num[i];
				num[i]=0;
			}else{
				cout<<"hoge"<<endl;
			}
			if(num[i]==fin){
				break;
			}
		}
		cout<<i<<endl;
	}
	return 0;
}

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

template<typename T,T e = 0>
struct SegmentTree{
    int length;
    vector<T> data;
    vector<int> l,r;

    inline T merge(const T& a,const T& b){
        return max(a,b);
    }

    T query(int i,int j){
        T ans = e;
        queue<int> que;
        que.push(0);
        int k;
        while(que.size()){
            k = que.front();
            que.pop();
            if(r[k] <= i || j <= l[k]){
                continue;
            }
            if(i <= l[k] && r[k] <= j){
                ans = merge(ans,data[k]);
                continue;
            }
            que.push(2*k+1);
            que.push(2*k+2);
        }
        return ans;
    }

    SegmentTree(vector<T> v) : length(1) {
        while(!(length >= v.size()))length *= 2;
        data = vector<T>(length*2-1,e);
        for(int i = length-1;i < length-1+v.size();i++){
            data[i] = v[i-length+1];
        }
        for(int i = length-2;0 <= i;i--){
            data[i] = merge(data[i*2+1],data[i*2+2]);
        }
        l.resize(length*2-1);
        r.resize(length*2-1);
        for(int i = length-1;i < length*2-1;i++){
            l[i] = i - length + 1;
            r[i] = min(i-length+2,(int)v.size());
        }
        for(int i = length-2;0 <= i;i--){
            l[i] = l[i*2+1];
            r[i] = r[i*2+2];
        }
    };

};

int solve(int N,int M){
    vector<int> upper(N,0),lower(N,0);
    for(int i = 0;i < M;i++){
        int S,k;
        cin >> S >> k;
        if(k == 1){
            int c;
            cin >> c;
            c--;
            upper[c] += S;
            lower[c] += S;
        }else{
            for(int j = 0;j < k;j++){
                int c;
                cin >> c;
                c--;
                upper[c] += S;
            }
        }
    }
    SegmentTree<int> st(upper);
    int ans = max(st.query(1,N)-lower[0],st.query(0,N-1)-lower[N-1]);
    for(int i = 1;i < N-1;i++){
        int tmp = max(st.query(0,i),st.query(i+1,N)) - lower[i];
        ans = max(ans,tmp);
    }
    return ans + 1;
}

int main(){
    int N,M;
    while(true){
        cin >> N >> M;
        if(!N)break;
        cout << solve(N,M) << endl;
    }
}


Measured memory_bytes: 3432
package main

import (
	"fmt"
)

func main() {
	var a, b, c int
	fmt.Scan(&a, &b, &c)
	if a == b && a != c || a == c && a != b || b == c && a != b {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}


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

using namespace std;
using ll = long long;

int main() {
    int n;
    cin >> n;
    string s;
    
    map<string, int> m;
    for (int i = 0; i < n; i++) {
        cin >> s;
        m[s]++;
    }

    int maxv = 0;
    for (const auto &x : m) {
        int v = x.second;
        if (maxv < v) {
            maxv = v;
        }
    }

    for (auto it = m.begin(); it != m.end(); it++) {
        if (it->second == maxv) {
            cout << it->first << endl;
        }
    }
    return 0;
}

Measured memory_bytes: 25216