akhauriyash/Code-Regression huggingface dataset:
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define pb push_back
#define F first
#define S second
#define ins insert
#define mp make_pair
#define fo(i, n1, n, x) for(int i = n1; i <= n; i += x)
#define foo(i, n, n1, x) for(int i = n; i >= n1; i -= x)
#define bit __builtin_popcount
#define md (l + ((r - l) / 2))
#define all(x) x.begin(),x.end()
#define eb emplace_back
#define ub upper_bound
#define lb lower_bound
#define ios ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define file(s) if (fopen(s".in", "r")) freopen(s".in", "r", stdin), freopen(s".out", "w", stdout)

using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
typedef long double ld;

const int N = 5e3 + 11, mod = 1e9 + 7, mod2 = 998244353;
const int MAX = 1e5 + 11;
const int INF1 = 2e9 + 11;
const ll INF2 = 2e18 + 11;
const double INF3 = 1e8 + 11;
const int base = 500;
const int P = 31;
const int dx[] = {1, -1, 0, 0, 1, 1, -1, -1};
const int dy[] = {0, 0, 1, -1, 1, -1, 1, -1};
const double EPS = 1e-4;
const double PI = acos(-1.0);


template<typename T> using ordered_set = tree <T, null_type, less <T>, rb_tree_tag, tree_order_statistics_node_update>;
template<typename T1, typename T2> inline void chmin(T1 &a, T2 b) { if (a > b) a = b; }
template<typename T1, typename T2> inline void chmax(T1 &a, T2 b) { if (a < b) a = b; }

#define int ll

typedef pair <int, int> pii;
typedef pair <ll, ll> pll;


mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

int n, p[N], p2[N], h[N], h2[N];
string s;
pii get(int l, int r) {
    int f, s;
    f = (l ? (h[r] - (h[l - 1] * p[r - l + 1]) % mod + mod) % mod : h[r]);
    s = (l ? (h2[r] - (h2[l - 1] * p2[r - l + 1]) % mod2 + mod2) % mod2 : h2[r]);
    return mp(f, s);
}
bool can(int len) {
    for (int i = 0; i < n - len + 1; ++i) {
        for (int j = i + len; j < n - len + 1; ++j) {
            if (get(i, i + len - 1) == get(j, j + len - 1)) return 1;
        }
    }
    return 0;
}
main() {
    file("rvq");
    ios;
    cin >> n >> s;
    h[0] = h2[0] = s[0];
    p[0] = p2[0] = 1;
    fo(i, 1, n + 5, 1) p[i] = (p[i - 1] * P) % mod, p2[i] = (p2[i - 1] * P) % mod2;
    for (int i = 1; i < n; ++i) {
        h[i] = (h[i - 1] * P) + s[i], h[i] %= mod;
        h2[i] = (h2[i - 1] * P) + s[i], h2[i] %= mod2;
    }
    int l = 0, r = n;
    while (l <= r) can(md) ? l = md + 1 : r = md - 1;
    --l;
    cout << l;
    return 0;
}
/**

*/


Measured memory_bytes: 384
N, A, B = [int(i) for i in input().split()]

def func_de(n):
    ans = 0
    while n/10 != 0:
        ans += n % 10
        n //= 10
    return ans

ANS = 0
for i in range(N+1):
    if A <= func_de(i) <= B:
        ANS += i

print(ANS)

Measured memory_bytes: 2940
import java.util.Scanner;
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 = a * b;
    if(c % 2 == 0)
      System.out.println("Even");
    else
      System.out.println("Odd");
  }
}




Measured memory_bytes: 21844
#include<bits/stdc++.h>
using namespace std;
int n;
double a, res = 0;
int main () {
  if (fopen ("test.inp", "r")) {
    freopen ("test.inp", "r", stdin);
  }
  ios_base :: sync_with_stdio (0);
  cin.tie (nullptr);
  cout.tie (nullptr);
  cin >> n;
  for (int i = 1; i <= n; ++ i) {
    cin >> a;
    res += double (1.0) / a;
  }
  cout << setprecision (6) << fixed << double (1.0) / res;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long 
#define endl "\n"
#define pb push_back
#define f(i,n) for(i=0;i<n;i++)
#define F(i,a,b) for(i=a;a<=b;i++)
#define arr(a,n) for( i=0;i<n;i++)cin>>a[i];
#define fi first
#define se second
#define mp make_pair
#define mod 1000000007
#define YES cout<<"YES"<<endl;
#define Yes cout<<"Yes"<<endl;
#define NO cout<<"NO"<<endl;
#define No cout<<"No"<<endl;
#define yes cout<<"yes"<<endl;
#define no cout<<"no"<<endl;
#define vi vector<ll>
#define ed end()
#define bg begin()
#define sz size()
#define ln length()
#define s() sort(a,a+n);
#define sr() sort(a,a+n,greater<ll>());
#define v()  sort(v.begin(),v.end());
#define vr() sort(v.begin(),v.end(),greater<ll>());
#define mod 1000000007
#define fast() ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
ll gcd(ll a, ll b){if(!b)return a;return gcd(b, a % b);}
ll power(ll x,ll y,ll p){ll res=1;x%=p;while(y>0){if(y&1)res=(res*x)%p;y=y>>1;x=(x*x)%p;}return res;}
int main() {
   /* #ifndef ONLINE_JUDGE
        // for getting input from input.txt
        freopen("input.txt", "r", stdin);
        // for writing output to output.txt
        freopen("output.txt", "w", stdout);
    #endif*/
        /* 
        Ofcourse it's Hard.
        It's supposed to be Hard.
        If it's easy everyone would do it.
        HARD IS WHAT MAKES IT GREAT

        YESTERDAY U SAID TOMORROW

        SLOWLY BECOMING THE PERSON I 
        SHOULD HAVE BEEN A LONG TIME AGO

        SAME TASK CAN'T BE FOUND DIFFICULT TWICE

        BTBHWSITW

        SPRH TU KAB P

        CP IS ALL ABOUT THINKING 
        YOU HAVE MUCH MORE POTENTIAL THAN U THINK

        AJIT SHIDDAT 10

        UR DAILY ROUTINE 


        */

fast();
//ll t;cin>>t;while(t--)
{
    ll a,b,c,d,n;
    cin>>n;
    d=n%10;n/=10;
    c=n%10;n/=10;
    b=n%10;n/=10;
    a=n%10;
    //cerr<<a<<" "<<b<<" "<<c<<" "<<d<<endl;
    if(a+b+c+d==7)
    {
      cout<<a<<"+"<<b<<"+"<<c<<"+"<<d<<"=7"<<endl;
    }
    else if(a+b+c-d==7)
    {
       cout<<a<<"+"<<b<<"+"<<c<<"-"<<d<<"=7"<<endl;
    }
    else if(a+b-c+d==7)
    {
       cout<<a<<"+"<<b<<"-"<<c<<"+"<<d<<"=7"<<endl;
    }
    else if(a+b-c-d==7)
    {
       cout<<a<<"+"<<b<<"-"<<c<<"-"<<d<<"=7"<<endl;
    }
    else if(a-b+c+d==7)
    {
       cout<<a<<"-"<<b<<"+"<<c<<"+"<<d<<"=7"<<endl;
    }
    else if(a-b+c-d==7)
    {
       cout<<a<<"-"<<b<<"+"<<c<<"-"<<d<<"=7"<<endl;
    }
    else if(a-b-c+d==7)
    {
        cout<<a<<"-"<<b<<"-"<<c<<"+"<<d<<"=7"<<endl;
    }
    else if(a-b-c-d==7)
    {
         cout<<a<<"-"<<b<<"-"<<c<<"-"<<d<<"=7"<<endl;
    }
}
return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)  FOR(i,0,n)
#define req(i,n) for(int i = 1;i <=n;i++)
#define pai 3.14159265358979323846
const int INF = 1001001001;
typedef long long ll;
int A[3][3], N;
bool punched[3][3];
bool ok[3][3];
using Graph = vector<vector<int>>;
vector<vector<int>> field;
vector<bool> seen;

const int MOD = 1000000007;
typedef pair<int,int> P;

//最大公約数
int gcd(int a,int b){
	if (a%b == 0){
		return b;
	}
	else{
		return gcd(b,a%b);
	}

}

//最小公倍数
int lcm(int a,int b){
	return a /gcd(a,b) * b;
}

//素数判定
bool is_prime(long long N) {
    if (N == 1) return false;
    for (long long i = 2; i * i <= N; ++i) {
        if (N % i == 0) return false;
    }
    return true;
}



  








      

 
int main() {
  
     ll q,h,s,d,n;
     cin >> q >> h >> s >> d >> n;
     ll one = min({q*4,h*2,s});
     cout << min(one*n,d*(n/2)+one*(n%2)) << endl;
 }


Measured memory_bytes: 3636
#include <stdio.h>
 
int main(){
  int a,b;
  int max;
  
  scanf("%d %d",&a,&b);
  
  max=a+b;
  if(max<(a-b)){
    max=a-b;
  }
  if(max<(a*b)){
    max=a*b;
  }
  
  printf("%d",max);
}

Measured memory_bytes: 128
from bisect import bisect_left

n, m = map(int, input().split())

div = []
i = 1
while i * i <= m:
    if m % i == 0:
        div.append(i)
        div.append(m // i)
    i += 1

div.sort()

print(m // div[bisect_left(div, n)])

Measured memory_bytes: 63916
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[][] array = new int[n][2];
        for (int i = 0; i < n; i++) {
            array[i][0] = sc.nextInt();
        }
        for (int i = 0; i < n; i++) {
            array[i][1] = sc.nextInt();
        }
        
        int sum = 0;
        for (int i = 0; i < n; i++) {
            int s = array[i][0] - array[i][1];
            if (s > 0) {
                sum += s;
            }
        }
        System.out.println(sum);
    }
}


Measured memory_bytes: 23380
N, x = map(int, input().split())
A = list(map(int, input().split()))

ans = 0

if A[0] > x:
    ans += A[0] - x
    A[0] = x

if A[-1] > x:
    ans += A[-1] - x
    A[-1] = x

for i in range(N - 1):
    sa = A[i] + A[i + 1] - x
    if sa > 0:
        ans += sa
        A[i + 1] -= sa

print(ans)


Measured memory_bytes: 14252
A = list(map(int, input().split()))
a = str(A[0])
b = str(A[1])
list=[]
for i in range(A[1]-1):
  a += str(A[0])
list.append(a)
  
for i in range(A[0]-1):
  b += str(A[1])
list.append(b)

print(sorted(list)[0])

Measured memory_bytes: 3064
package main

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

var sc = bufio.NewScanner(os.Stdin)

func Scan() string {
	sc.Scan()
	return sc.Text()
}
func iScan() int {
	n, _ := strconv.Atoi(Scan())
	return n
}
func fScan() float64 {
	n, _ := strconv.ParseFloat(Scan(), 64)
	return n
}
func stringToInt(s string) int {
	n, _ := strconv.Atoi(s)
	return n
}
func SScan(n int) []string {
	a := make([]string, n)
	for i := 0; i < n; i++ {
		a[i] = Scan()
	}
	return a
}
func iSScan(n int) []int {
	a := make([]int, n)
	for i := 0; i < n; i++ {
		a[i] = iScan()
	}
	return a
}
func abs(x int) int {
	if x < 0 {
		x = -x
	}
	return x
}
func larger(a, b int) int {
	if a < b {
		return b
	} else {
		return a
	}
}
func smaller(a, b int) int {
	if a > b {
		return b
	} else {
		return a
	}
}
func max(a []int) int {
	x := a[0]
	for i := 0; i < len(a); i++ {
		if x < a[i] {
			x = a[i]
		}
	}
	return x
}
func min(a []int) int {
	x := a[0]
	for i := 0; i < len(a); i++ {
		if x > a[i] {
			x = a[i]
		}
	}
	return x
}
func sum(a []int) int {
	x := 0
	for _, v := range a {
		x += v
	}
	return x
}

var mod int = 1000000007

func main() {
	buf := make([]byte, 0)
	sc.Buffer(buf, mod)
	sc.Split(bufio.ScanWords)
	n := iScan()
	b := iSScan(n - 1)
	ans := b[0] + b[n-2]
	for i := 1; i < n-1; i++ {
		ans += smaller(b[i], b[i-1])
	}
	fmt.Println(ans)
}


Measured memory_bytes: 1780
#include <cstdio>
#include <cstring>
using namespace std;
int n,p,ans=0;
int f[100001];
int main(){
	memset(f,0,sizeof(f));
	scanf("%d",&n);
	for(int i=1;i<=n;i++){
		scanf("%d",&p);
		if(p>100000)ans++;
		else f[p]++;
	}
	for(int i=1;i<100001;i++){
		if(f[i]<i)ans+=f[i];
		else if(f[i]>i)ans+=f[i]-i;
	}
	printf("%d",ans);
	return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
#define ll long long
 
int solve(int i,int a[], int dp[],int k){
	// if(i==1){
	// 	return abs(a[i]-a[0]);
	// }
	// if(i==0){
	// 	return 0;
	// }
	int ans = INT_MAX;
	// int c = abs(a[i]-a[i-1]);
	for(int j=1; j<=k && (i-j)>=0; j++){
		if(dp[i-j]==-1)
			dp[i-j] =  solve(i-j,a,dp,k);
		int d = abs(a[i]-a[i-j])+dp[i-j];
		ans = min(ans,d);
	}
	// if(dp[i-2]==-1)
	// 	dp[i-2] = solve(i-2,a,dp);
	// e = abs(a[i]-a[i-2])+dp[i-2];

	return ans;

}
 
 
int main() {
	int n,k;
	cin >> n>>k;
	int a[n];
	int dp[n];
	memset(dp,-1,sizeof(dp));
	dp[0]=0;
	
	for(int i=0;i<n;i++)
		cin >> a[i];
	cout<<solve(n-1,a,dp,k)<<endl;
}

Measured memory_bytes: 10368
#include <iostream>
#include <string>
#include <sstream>
#include <algorithm>
#include <vector>
#include <utility>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <map>
#include <set>
#include <stack>
#include <queue>
 
using namespace std;
 
#define pb(n)	push_back(n)
#define mp(n,m) make_pair(n,m)
#define fi 	first
#define se 	second
#define all(r) (r).begin(),(r).end()
 
#define REP(i,s,e)	for(int i=(s); i<(e); i++)
#define rep(i,n)	REP(i,0,n)
#define REPE(i,s,e)	for(int i=s; i>e; i--)
#define repe(i,n)	REPE(i,n,-1)


typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
 
typedef vector<vi> vvi;
 
const int IMAX=((1<<30)-1)*2+1;
const int INF=100000000;
const double EPS=1e-10;
//int mod=1000000007
 

vector<string> split(const string &s,char c){
	vector<string> ret;
	stringstream ss(s);
	string t;
	while(getline(ss,t,c)){
		ret.pb(t);
	}
	return ret;
}

int main(){
	string s;
	getline(cin,s);
	vector<string> v=split(s,' ');
	stack<int> sta;
	string e[3]={"+","-","*"};
	rep(i,v.size()){
		if(v[i]==e[0]||v[i]==e[1]||v[i]==e[2]){
			int a=sta.top();
			sta.pop();
			int b=sta.top();
			sta.pop();
			if(v[i]==e[0]) sta.push(a+b);
			else if(v[i]==e[1]) sta.push(b-a);
			else sta.push(b*a);
		}
		else sta.push(atoi(v[i].c_str()));
	}
	cout<<sta.top()<<endl;
}

Measured memory_bytes: 1220
#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<vector>
#include<iostream>
#include<string>
#include<cstdlib>
using namespace std;
int main(void)
{

	int n, a, b;
	int ans;
	cin >> n >> a >> b;
	if (a*n < b)
	{
		ans = a * n;
	}
	else
	{
		ans = b;
	}
	cout << ans << endl;
	return 0;

}


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

#define pai 3.1415926535


int main(void) {

	int N;
	scanf("%d", &N);
	char s[101];
	scanf("%s", s);
	int count_R = 0, count_B = 0;
	for (int i = 0; i < strlen(s); i++) {
		if (s[i] == 'R') {
			count_R++;
		}
		else {
			count_B++;
		}
	}

	if (count_R > count_B) {
		printf("Yes\n");
	}
	else {
		printf("No\n");
	}

	return 0;


}

Measured memory_bytes: 128
//Crane and Turtle
#include <iostream>
#include <vector>
#include <math.h>
#include <string>
#include <map>
#include <stdio.h>
#include <string.h>
#include <initializer_list>
#include <algorithm>
#include <numeric>
#include <iomanip>
#include <queue>
#include <set>
using namespace std;
const int INF = 1 << 29;
int main ()
{
    int X, Y;
    cin >> X >> Y;

    for (int i = 0; i <= X; i++) {
        if (i * 2 + (X - i) * 4== Y) {
            cout << "Yes" << endl;
            return 0;
        } 
    }
    cout << "No" << endl;

    return 0;
}

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

int main() {
    int N;
    cin >> N;
    N = N % 26;
    string S;
    cin >> S;
    string AL = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";

    for (auto e : S) {
        int index = AL.find(e);
        index += N;
        if (index >= 26) index = index - 26;
        cout << AL[index];
    }
    cout << endl;
}

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

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

using namespace std;

using ll = long long;
using P = pair<int, int>;

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

  string result;
  if (r < 1200) {
    result = "ABC";
  } else if (r < 2800) {
    result = "ARC";
  } else {
    result = "AGC";
  }
  cout << result << endl;

  return 0;
}


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

int main()
{
    int a,b;
    cin >> a >> b;
    int cnt = 0;
    int x = 1, y = 1;
    while(x<=a)
    {

        if(x<a)
        cnt++;
        else if(x==a && x<=b)
        {
            cnt++;
        }

        x++;

    }
    cout << cnt << endl;
}


Measured memory_bytes: 3564
#include <stdio.h>

int main()
{
	int train, train_hodai, bus, bus_hodai;
  	scanf("%d%d%d%d", &train, &train_hodai, &bus, &bus_hodai);
  	
  	if (train > train_hodai){
    	train = train_hodai;
    }
  	if (bus > bus_hodai){
    	bus = bus_hodai;
    }
  	printf("%d", train + bus);
}

Measured memory_bytes: 128
#include<cstdio>
#include<algorithm>
using namespace std;
int a[100010];
int tmp;
int n,ans=1;
int main(){
    scanf("%d",&n);
    for(int i=1;i<=n;++i)
        scanf("%d",&a[i]);
    sort(a+1,a+n+1);
    tmp=a[1];
    for(int i=2;i<=n;++i){
        if(tmp==a[i]){
            --ans;
            tmp=-1;
        }
        else{
            ++ans;
            tmp=a[i];
        }
    }
    printf("%d\n",ans);
    return 0;
}

Measured memory_bytes: 512
void main() {
	auto N = ri;
	pow(2, log2(N).to!int).writeln;
}

// ===================================

import std.stdio;
import std.string;
import std.conv;
import std.algorithm;
import std.range;
import std.traits;
import std.math;
import std.container;
import std.bigint;
import std.numeric;
import std.conv;
import std.typecons;
import std.uni;
import std.ascii;
import std.bitmanip;
import core.bitop;

T readAs(T)() if (isBasicType!T) {
	return readln.chomp.to!T;
}
T readAs(T)() if (isArray!T) {
	return readln.split.to!T;
}

T[][] readMatrix(T)(uint height, uint width) if (!isSomeChar!T) {
	auto res = new T[][](height, width);
	foreach(i; 0..height) {
		res[i] = readAs!(T[]);
	}
	return res;
}

T[][] readMatrix(T)(uint height, uint width) if (isSomeChar!T) {
	auto res = new T[][](height, width);
	foreach(i; 0..height) {
		auto s = rs;
		foreach(j; 0..width) res[i][j] = s[j].to!T;
	}
	return res;
}

int ri() {
	return readAs!int;
}

double rd() {
	return readAs!double;
}

string rs() {
	return readln.chomp;
}


Measured memory_bytes: 256
a, b=map(int,input().split())

# a>=bなら1
# 2a-1(=a+a-1)>=bのとき2
# a+2(a-1)>=bのとき3
#電源タップC個使用するとして
#a+(a-1)(c-1)=a+ac-a-c+1=(a-1)c+1個のコンセントがりようできるので、b=<(a-1)c+1<b+aとなるcを求めれば良い
#(b-1)/(a-1)<=c & c<b/(a-1)+1 を満たすC
#b/(a-1)+1=(b-1)/(a-1)+1/(a-1)+1=(b-1)/(a-1)+a/(a-1)
#(b-1)/(a-1)<=c & c<(b-1)/(a-1)+a/(a-1) を満たすC
#(b-1)/(a-1)の切り上げ
print((b+a-3)//(a-1))

Measured memory_bytes: 2940
from sys import stdin


def main():
    input = lambda: stdin.readline()[:-1]
    N = int(input())
    A = list(map(int, input().split()))

    A.sort(reverse=1)
    d, m = divmod(N, 2)
    n = [2] * (d + m)
    n[-1], n[0] = n[-1] - m, 1
    ans = 0
    for i, k in enumerate(n):
        ans += A[i] * k
    print(ans)


main()


Measured memory_bytes: 31488
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
const int mod = 1e9 + 7;
//const int mod = 998244353;
const ll infll = (1LL << 62) - 1;
const int inf = (1 << 30) - 1;
void YesNo(bool j){cout << (j ? "Yes" : "No") << endl; return;}
void yesno(bool j){cout << (j ? "yes" : "no") << endl; return;}
template<class Head> void pt(Head&& head){cout << head << endl; return;}



int main() {
    int a,b,c,d,e;
    cin >> a >> b>> c >> d >> e;
    if(a==0) cout << 1 << endl;
    else if(b==0) cout << 2 << endl;
    if(c==0) cout << 3 << endl;  if(d==0) cout << 4 << endl;  if(e==0) cout << 5 << endl;
    return 0;
}


Measured memory_bytes: 3628
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
using namespace std;
 
void insort(int n, int a[])
{
	int max;
	for(int i = 0; i < n - 1; ++i) {
		max = i;
		for(int j = i; j < n; ++j)
			if(a[j] > a[max])
				max = j;
		swap(a[i], a[max]);
	}
}
 
int main(void)
{
	int n, k, l[50], ans = 0;
	cin >> n >> k;
	for(int i = 0; i < n; ++i)
		cin >> l[i];
	insort(n, l);
	for(int i = 0; i < k; ++i)
		ans += l[i];
 
	cout << ans << endl;
 
	return 0;
}

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

typedef long long ll;

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

int main() { 
    string A,B;
    cin >> A;
    cin >> B;
    if (A.length() == B.length()) {
        rep(i, A.length()){
            if (A[i] < B[i]) {
                cout << "LESS" << "\n";
                return 0;
            } else if (A[i] > B[i]) {
                cout << "GREATER" << "\n";
                return 0;
            } else {
                continue;
            }
        }
    } else {
        if (A.length() < B.length()) {
            cout << "LESS" << "\n";
            return 0;
        } else {
            cout << "GREATER" << "\n";
            return 0;
        }
    }
    cout << "EQUAL" << "\n";

    return 0;
}


Measured memory_bytes: 3616
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <map>
#include <cmath>
#include <queue>
#include <deque>
#include <set>
#include <iomanip>
using namespace std;

int main() {
    int A, B, T; cin >> A >> B >> T;
    cout << T/A*B << endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n1) for(int i=0;i<n1;++i)
#define rrep(i,n) for(int i=n-1;i>=0;--i)
#define REP(i,a,b) for(int i=a;i<b;i++)
#define yesno(flg) if(flg){cout<<'YES'<<endl;}else{cout<<'NO'<<endl;}
#define vi vector<int>
#define pb push_back
#define i197 1000000007
#define MAX_N 200002
#define PI 3.141592653589793
using namespace std;

typedef long long ll;
typedef pair<int,int> Pii;
typedef pair<Pii,int> Piii;
typedef pair<int,ll> Pil;
typedef pair<ll,ll> Pll;
typedef pair<string,int> Psi;
typedef pair<Psi,int> Psii;

const ll inf=1000000007;
struct edge{
	int myc,to,c,cost;
};
struct pos{
	int to,cost,color;
};
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};

vector<Pii> v[100001];
ll dp[300000][60]={};
ll dp2[300000][60]={};
int main() {
	int n;
	int k=0;
	cin>>n;
	rep(i,n){
		int a;
		cin>>a;
		if(a==(k+1))k++;
	}
	if(k==0){
		cout<<"-1";
	}else{
		cout<<(n-k);
	}
	
	return 0;
}


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

using VS = vector<string>;    using LL = long long;
using VI = vector<int>;       using VVI = vector<VI>;
using PII = pair<int, int>;   using PLL = pair<LL, LL>;
using VL = vector<LL>;        using VVL = vector<VL>;

#define ALL(a)  begin((a)),end((a))
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define SZ(a) int((a).size())
#define SORT(c) sort(ALL((c)))
#define RSORT(c) sort(RALL((c)))
#define UNIQ(c) (c).erase(unique(ALL((c))), end((c)))
#define FOR(i, s, e) for (int(i) = (s); (i) < (e); (i)++)
#define FORR(i, s, e) for (int(i) = (s); (i) > (e); (i)--)
#define debug(x) cerr << #x << ": " << x << endl
const int INF = 1e9;                          const LL LINF = 1e16;
const LL MOD = 1000000007;                    const double PI = acos(-1.0);
int DX[8] = { 0, 0, 1, -1, 1, 1, -1, -1 };    int DY[8] = { 1, -1, 0, 0, 1, -1, 1, -1 };

/* -----  2018/02/23  Problem: 082_arc_b / Link: https://arc082.contest.atcoder.jp/tasks/arc082_b?lang=en  ----- */
/* ------問題------

1,2,..,N からなる順列 p1,p2,..,pN が与えられます。 次の操作を何回か (0回でもよい) 行うことが出来ます。
操作: 順列で隣り合う二つの数を選んでスワップする。
何回か操作を行って、任意の 1≤i≤N に対して pi≠i となるようにしたいです。 必要な操作の最小回数を求めてください。

-----問題ここまで----- */
/* -----解説等-----

片側からやっていくと最後の数以外が必ず条件を満たす。
これは順序を入れ替えることで解決可能であるから、そのままチェックをかけるだけで良い。

----解説ここまで---- */

LL N;

LL ans = 0LL;

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

	cin >> N;
	VL a(N);
	FOR(i, 0, N) {
		cin >> a[i];
	}

	FOR(i, 0, N-1) {
		if (a[i] == i+1) {
			swap(a[i], a[i + 1]);
			ans++;
		}
	}
	if (a[N - 1] == N)ans++;
	cout << ans << "\n";

	return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <set>
#include <map>
#include <numeric>
#include <regex>
#include <tuple>
using namespace std;

typedef long long ll;
typedef pair<int, int> P;
#define MOD 1000000007 // 10^9 + 7
#define INF 1000000000 // 10^9
#define LLINF 1LL<<60


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

	int k;
	int pos[5];
	for (int i = 0; i < 5; i++) cin >> pos[i];
	cin >> k;
	bool flag = true;
	for (int i = 0; i < 5; i++) {
		for (int j = 0; j < 5; j++) {
			if (i != j && abs(pos[i] - pos[j]) > k) flag = false;
		}
	}

	if (flag) cout << "Yay!" << endl;
	else cout << ":(" << endl;

	return 0;
}

Measured memory_bytes: 256
// Sakhiya07 - Yagnik Sakhiya
 
#include <bits/stdc++.h>
using namespace std;
 
#define ll long long int
#define ld long double
#define ff first
#define ss second
#define pb push_back
#define all(x) x.begin(),x.end()
 
#define mp make_pair
#define bp __builtin_popcountll
#define MOD  1000000007
const int N = 62;
#define FAST ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);srand(time(NULL));

void solve()
{
     ll n;
     cin >> n;
     ll ans = 0;
     ll temp = n-1;
     for(ll i=1;i*i<=temp;i++)
     {
          if(temp%i==0)
          {
               if(i!=1)  ans++;
               if(i!=temp/i)   ans++; 
          }
     }
     for(ll i=1;i*i<=n;i++)
     {
          if(n%i==0)
          {
               ll temp1 = n;
               ll div1 = i;
               while(div1!=1 && temp1%div1==0)   temp1/=div1;
               if(temp1%div1==1)    ans++;
               temp1 = n;
               if(i!=n/i)
               {
                    div1 = n/i;
                    while(temp1%div1==0)   temp1/=div1;
                    if(temp1%div1==1)    ans++;
               }      
          }
     }
     cout<<ans;
}

int main()
{
     FAST;
     ll t = 1;
    // cin >> t;
     while(t--)
     {
         
          solve();
     }
}

Measured memory_bytes: 256
//region #include <cp_helper>
#include <algorithm>
#include <array>
#include <bitset>
#include <cstring>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <iterator>//region #include <cp_helper>
#include <algorithm>
#include <array>
#include <bitset>
#include <cstring>
#include <deque>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <vector>
using namespace std;
#define io() ios_base::sync_with_stdio(false); cin.tie(nullptr)
#define ll long long
#define ull unsigned long long
#define ii pair<int, int>
#define vi vector<int>
#define vvi vector<vi>
#define vll vector<ll>
#define vii vector<ii>
#define in(n) cin >> n
#define in2(n, m) cin >> n >> m
#define pin(n) in(n.first) >> n.second
#define vin(a, n) for (ll i=0; i<n; ++i) in(a[i])
#define viin(a, n) for (ll i=0; i<n; ++i) in2(a[i].first, a[i].second);
#define out(n) cout << n
#define outs(n) out(n) << ' '
#define outn(n) out(n) << '\n'
#define out2(n, m) cout << n << ' ' << m
#define out2s(n, m) out2(n, m) << ' '
#define out2n(n, m) out2(n, m) << '\n'
#define pout(n) out2(n.first, n.second)
#define pouts(n) pout(n) << ' '
#define poutn(n) pout(n) << '\n'
#define vout(a) for (auto i : a) outs(i)
#define viout(a) for (auto i : a) out2n(i.first, i.second)
#define all(a) a.begin(), a.end()
#define qsort(a) sort(all(a))
#define qsortd(a) sort(all(a), greater<>())
#define qsortf(a, f) sort(all(a), f)
#define pp(a, b) emplace_back(make_pair(a, b))
#define fori(i, n) for (ll i=0; i<n; ++i)
#define foris(i, a, b) for (ll i=a; i<b; ++i)
#define ford(i, n) for (ll i=n-1; i>=0; --i)
#define fords(i, a, b) for (ll i=a; i>=b; --i)
#define forr(i, a) for (auto i : a)
const int mod = (int)(1e9) + 7;
//endregion

int main() {
    int n;
    string s;
    in2(n, s);
    out((n < 3200 ? "red" : s));
}



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

using namespace std;

int main()
{
  int N, A, x[50];

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

  long long dp[51][2501] = {{}};
  dp[0][0] = 1;
  for(int i = 0; i < N; i++) {
    for(int k = N; k > 0; k--) {
      for(int j = 2500; j >= x[i]; j--) {
        dp[k][j] += dp[k - 1][j - x[i]];
      }
    }
  }
  int sub = 0;
  long long ret = 0;
  for(int i = 1; i <= N; i++) {
    sub += A;
    ret += dp[i][sub];
  }

  cout << ret << endl;
}

Measured memory_bytes: 1280
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>

using namespace std;

#define FOR(i, n) for(int i = 0; i < (int) n; i++)
#define all(v) v.begin(), v.end()
#define F first
#define S second


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

const ll MOD = 1e9+7;
const int INF = 1e9+7;

vector<vi> graph;
vi dist;
vector<bool> vis;

int dfs(int i){
	vis[i] = true;
	for(auto&p : graph[i]){
		if(!vis[p]){
			int ret = dfs(p);
			dist[i] = max(dist[i], ret+1);
		}else{
			dist[i] = max(dist[i], dist[p]+1);
		}
	}
	return dist[i];
}

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

	int n, m; cin >> n >> m;
	graph.resize(n);
	dist.assign(n, 0);
	vis.assign(n, false);
	FOR(i, m){
		int a, b; cin >> a >> b;
		graph[a-1].push_back(b-1);
	}

	int maxi = 0;
	FOR(i, n){
		maxi = max(maxi, dfs(i));
		vis[i] = true;
	}

	cout << maxi << '\n';

	return 0;
}

Measured memory_bytes: 8192
#include<iostream>
#include<set>
#include<stack>
#include<queue>
#include<string>
#include<algorithm>//min,max,swap,rand,reverse,sort,lower_bound
#include<functional>
#include<vector>
#include<list>
#include<map>
#include<tuple>
#include<cmath>//abs, sin, cos
#include<bitset>
using namespace std;

int main()
{
	set<int> P;
	int N;
	int slime = 0;
	cin >> N;
	char S[N + 1];
	char O[N + 1];
	cin >> S;
	for (int i=0; i < N; i++) {
		if (i == N - 1 && S[i]!=S[i-1]) {
			slime++;
		}
		else
		{
			if (S[i] != S[i + 1])
				slime++;
		}
	}

	cout << slime << endl;
	return 0;
}

Measured memory_bytes: 384
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <cstring>
#include <map>
#include <queue>
#include <cmath>
#include <complex> // complex<double> a(1.2 , 2.3);// real(): 1.2, imag()2.3
using namespace std;

#define MOD 1000000007
#define ll long long
#define ld long double
#define FOR(i,a,b) for(ll i=(ll)a;i<(ll)b;i++)
#define rep(i,n) FOR(i,0,n)
#define pb push_back
#define mp make_pair
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define rmsame(a) sort(all(a)),a.erase(unique(all(a)), a.end())
#define rmvector(a,b) rep(i,a.size())rep(j,b.size())if(a[i]==b[j]){a.erase(a.begin()+i);i--;break;}
#define pq_pair_tB priority_queue <pair<ll,ll>, vector<pair<ll,ll> > , greater<pair<ll,ll> > > 
#define pq_pair_ts priority_queue <pair<ll,ll> > //第二成分の大きさが関係ない
template<typename X> bool exist(vector<X> vec, X item){return find(all(vec), item)!=vec.end();}
ll gcd(ll a, ll b){if(b==0)return a;return gcd(b,a%b);}
ll lcm(ll a, ll b){return a/gcd(a,b)*b;}


int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    ll N ;
    cin >> N;
    vector<ll> A;
    rep(i, N){
        ll inp; cin >> inp;
        A.pb(inp);
    }
    
    vector<ll> left(N), right(N);
    
    ll l = A[0], r = A[N-1];
    //for(ll i = 0; i < N; i++){
    rep(i, N){
        l = gcd(l, A[i]);
        left[i] = l;
        
        r = gcd(r, A[N-1-i]);
        right[N-1-i] = r;
    }

    ll ans = 0 ;
    rep(i, N){
        if(i == 0) ans = max(ans, right[i+1]);
        else if(i == N-1) ans = max(ans, left[i-1]);
        else ans = max(ans,  gcd(left[i-1], right[i+1]));
    }
    
    cout << ans << endl;
    
    
    //cout << fixed << setprecision(16) << ans << endl;
    return 0;
}


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

int main() {
  long n,ans=0;
  queue<vector<long>> a;
  cin >> n;
  a.push({3,1,0,0});
  a.push({5,0,1,0});
  a.push({7,0,0,1});
  while(true) {
    vector<long> b=a.front();
    a.pop();
    if(b[0]>n) break;
    if((b[1]>0&&b[2]>0)&&b[3]>0) ans++;
    for(long i=3;i<=7;i+=2) a.push({b[0]*10+i,b[1]+(i==3),b[2]+(i==5),b[3]+(i==7)});
  }
  cout << ans << endl;
}

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

namespace abc159_c
{
  class Program
  {
    static void Main(string[] args)
    {
      var L = CIn.ReadInt();
      var ans = Math.Pow((double)L / 3, 3);

      Console.WriteLine(ans);
    }
  }


  static class CIn
  {
    private static readonly Queue<string> fieldBuffer = new Queue<string>();

    public static string Read()
    {
      if (fieldBuffer.Count == 0)
      {
        foreach (var field in Console.ReadLine().Split())
        {
          fieldBuffer.Enqueue(field);
        }
      }
      return fieldBuffer.Dequeue();
    }

    public static int ReadInt() => int.Parse(Read());
    public static long ReadLong() => long.Parse(Read());
    public static double ReadDouble() => double.Parse(Read());

    public static string[] ReadStringArray(int n)
    {
      var array = new string[n];
      for (var i = 0; i < n; i++)
      {
        array[i] = Read();
      }
      return array;
    }

    public static int[] ReadIntArray(int n)
    {
      var array = new int[n];
      for (var i = 0; i < n; i++)
      {
        array[i] = ReadInt();
      }
      return array;
    }

    public static long[] ReadLongArray(int n)
    {
      var array = new long[n];
      for (var i = 0; i < n; i++)
      {
        array[i] = ReadLong();
      }
      return array;
    }

    public static double[] ReadDoubleArray(int n)
    {
      var array = new double[n];
      for (var i = 0; i < n; i++)
      {
        array[i] = ReadDouble();
      }
      return array;
    }

    public static char[,] ReadCharMatrix(int h, int w)
    {
      var array = new char[h, w];
      for (var i = 0; i < h; i++)
      {
        var l = Console.ReadLine().ToCharArray();
        for (var j = 0; j < w; j++)
        {
          array[i, j] = l[j];
        }
      }
      return array;
    }
  }
}


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

using namespace std;

//int N,M,K,L,R,H,W;
long long int N,M,K,L,R,H,W;

constexpr long long int MOD=1000000007;
//constexpr  int MOD=1000000007;
//constexpr int MOD=998244353;
//constexpr long long int MOD=998244353;

long long int power(long long int x, long long int n, long long int M) {
	long long int ret = 1;
	long long int by = x;
	while (n) {
		if (n & 1) {
			ret *= by;
			ret %= M;
		}
		by *= by;
		by %= M;
		n >>= 1;
	}
	return ret;
}

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	
	cin>>N>>M;
	if(N==1){
		cout<<(M+1)%MOD<<endl;
		return 0;
	}
	if(N>M+1){
		cout<<(M+1)%MOD<<endl;
		return 0;
	}
	long long int a=M-(N-1)+1;
	long long int v=-(N-1);
	long long int num=a/abs(v)+1;
	long long int ans=(a%MOD)*(num%MOD);
	a%=MOD;
	v+=MOD*MOD;
	v%=MOD;
	ans%=MOD;
	num%=MOD;
	//cout<<a<<" "<<v<<" "<<num<<endl;
	//cout<<ans<<endl;
	long long int add=v;
	add*=((num)*(num+MOD-1))%MOD;
	add%=MOD;
	add*=power(2,MOD-2,MOD);
	ans+=add;
	ans%=MOD;
	ans*=2;
	ans%=MOD;
	//cout<<ans<<endl;
	ans+=M+1;
	ans%=MOD;
	cout<<ans<<endl;
	
	
	return 0;
}


Measured memory_bytes: 3200
// Created by sz
#include <bits/stdc++.h>
using namespace std;

const int N = 1e5 + 5;
int n,m;

const int maxn = 1e3+5;
const long long  INF = 1e18;

struct Edge {
    int from, to, dist;
    Edge(int u, int v, int d):from(u),to(v),dist(d) {}
};

struct Bellman_ford {
    int n, m;
    vector<Edge> edges;
    vector<int> G[maxn];
    bool inq[maxn];
    bool neg[maxn];//点的路径上是否有负环
    long long d[maxn];//s到各个点的距离
    int p[maxn];//最短路中的上一条弧
    int cnt[maxn]; //点进队列次数
    
    
    void init(int n) {
        this->n = n;
        for(int i = 0; i < n; i++) G[i].clear();
        edges.clear();
    }
    
    void AddEdge(int from, int to, int dist) {
        edges.push_back(Edge(from, to, dist));
        m = edges.size();
        G[from].push_back(m-1);
    }
    
    
    //只能判断是否含环，不能判断到某点的路径上是否含环。
    bool bellman_ford_que(int s) {
        queue<int> Q;
        memset(inq, 0, sizeof(inq));
        memset(cnt, 0, sizeof(cnt));
        for(int i = 0; i < n; i++) d[i] = INF;
        d[s] = 0;
        inq[s] = true;  //标记是否在队列中
        Q.push(s);
        while(!Q.empty()) { //松弛到不能松弛为止
            int u = Q.front(); Q.pop();
            inq[u] = false;
            for(int i = 0; i < G[u].size(); i++) {
                Edge& e = edges[G[u][i]];
                if(d[u] < INF && d[e.to] > d[u] + e.dist) {
                    d[e.to] = d[u] + e.dist;
                    p[e.to] = G[u][i];
                    if(!inq[e.to]) {
                        Q.push(e.to);
                        inq[e.to] = true;
                        if(++cnt[e.to] > n) return false;
                    }
                }
            }
        }
        return true;
    }
    
    void bellman_ford(int s) {
        for(int i = 0; i < n; i++) d[i] = INF;
        d[s] = 0;
        //如果不含环，最短路最多经过n-1个点（不包括起点）， 松弛n-1次即可
        for (int k = 0; k < n-1; k++){
            for (int i = 0; i < m; i++){
                int x = edges[i].from;
                int y = edges[i].to;
                if(d[x]<INF) d[y] = min(d[y], d[x] + edges[i].dist);
            }
        }
        
        for (int k = 0; k < n-1; k++){
            for (int i = 0; i < m; i++){
                int x = edges[i].from;
                int y = edges[i].to;
                if(d[x]<INF && d[y] > d[x] + edges[i].dist) {
                    d[y] = d[x] + edges[i].dist;
                    neg[y] = true;
                }
                if(neg[x])neg[y] = true;
            }
        }
    }
};

Bellman_ford g;

void solve(){
    cin>>n>>m;
    g.init(n); //n为顶点数
    int x,y,c;
    for (int i = 1; i <= m; i++){
        cin>>x>>y>>c;
        x--, y--;  //顶点是从0开始编号
        g.AddEdge(x, y, -c);
    }
    g.bellman_ford(0);
    if(!g.neg[n-1]) cout<<-g.d[n-1]<<endl;
    else cout<<"inf"<<endl;
    
}

int main(){
#ifdef LOCAL
    freopen("./input.txt", "r", stdin);
#endif
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    
    solve();
    
    
    return 0;
}



Measured memory_bytes: 384
#include <stdio.h>

int main(){
    int x, kyu;

    scanf("%d", &x);

    if(x <= 599){
        kyu = 8;
    }else if(x <= 799){
        kyu = 7;
    }else if(x <= 999){
        kyu = 6;
    }else if(x <= 1199){
        kyu = 5;
    }else if(x <= 1399){
        kyu = 4;
    }else if(x <= 1599){
        kyu = 3;
    }else if(x <= 1799){
        kyu = 2;
    }else{
        kyu = 1;
    }

    printf("%d\n", kyu);
}

Measured memory_bytes: 1728
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author ExplodingFreeze
 */

#include <iostream>
#include <fstream>

#pragma comment(linker, "/stack:200000000")
#include <bits/stdc++.h>
#define int long long
#define f(i,a,b) for(int i=(a);i<(b);i++)
#define MOD 1000000007

using namespace std;

class CAntiDivision {
public:
	void solve(std::istream& in, std::ostream& out) {
		int a,b,c,d;
		in >> a >> b >> c >> d;
		int dist=b-a+1;
		int lcm=(c*d)/__gcd(c,d);
		out << (dist-((((b/c)-((a/c)+(a%c!=0))+1))+(((b/d)-((a/d)+(a%d!=0))+1))-(((b/lcm)-((a/lcm)+(a%lcm!=0))+1)))) << "\n";

	}
};


int32_t main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	CAntiDivision solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


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

typedef long long ll;
typedef pair<int, int> pii;

const int N = 1e5 + 11;
const int M = 1e6 + 11;
const int MOD = 1e9 + 7;

int main(int argc, char **args){
    ll X; cin >> X;
    ll sum = X / 500 * 1000 + (X - X / 500 * 500) / 5 * 5 ; 

    cout << sum << "\n";
return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
string a,b;
int main()
{
	cin>>a;
	b=a;
	reverse(a.begin(),a.end());
	for(int i=0;i<a.size();i++) 
	{
		if(a[i]=='b') a[i]='d';
		else if(a[i]=='d') a[i]='b';
		else if(a[i]=='p') a[i]='q';
		else if(a[i]=='q') a[i]='p';
	}
	bool flag = 1;
	for(int i=0;i<a.size();i++)
	if(a[i]!=b[i]) 
	{
		flag = 0;
		break;
	}
	if(flag) cout<<"Yes";
	else cout<<"No";
	cout<<endl;
}

Measured memory_bytes: 512
#include<stdio.h>
int main(void)
{
  int a, b, c, n;
  scanf("%d %d %d %d", &a, &b, &c, &n);
  if(abs(b-a)<=n&&abs(c-b)<=n||abs(c-a)<=n){
    printf("Yes\n");
  }else{
    printf("No\n");
  }
  return 0;
}

Measured memory_bytes: 128
#include <utility>
#include <iostream>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <vector>
#include <algorithm>
using namespace std;

int main(int argc, char const *argv[]) {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int N,M,X;
  std::cin >> N >> M >> X;
  int A;
  int toS=0;
  int toG=0;

  for (size_t i = 0; i < M; i++) {
    std::cin >> A;
    if (A<X) {
      toS++;
    }else{
      toG++;
    }
  }

  std::cout << min(toS,toG) << '\n';


  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <vector>
#include <array>
#include <queue>
#include <stack>
#include <set>
#include <utility>
using namespace std;

int main() {
  long long int a, b; cin >> a >> b;
  long long int l = 0;
  for (int i = 1; i <= b-a; i++) {
    l += i;
  }
  cout << l-b << endl;
}


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


typedef long long i64;
const int inf = (int)1.05e9;

struct node {
	int count[2];
	vector<int> edges[2];
};

int main()
{
	int n, m;
	char ababa[2 * 100000 + 5];

	scanf("%d%d", &n, &m);
	scanf(" %s", ababa);

	vector<node> g(n);

	for(int i = 0; i < m; ++i) {

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

		x -= 1;
		y -= 1;
		int xc = (ababa[x] == 'A' ? 0 : 1);
		int yc = (ababa[y] == 'A' ? 0 : 1);

		if(x == y) {
			g[x].count[yc] += 1;
			g[x].edges[yc].push_back(y);
		} else {
			g[x].count[yc] += 1;
			g[x].edges[yc].push_back(y);
			g[y].count[xc] += 1;
			g[y].edges[xc].push_back(x);
		}
	}

	vector<bool> live(n, true);
	queue<int> q;

	for(int i = 0; i < n; ++i) {
		if(g[i].count[0] <= 0 || g[i].count[1] <= 0)
			q.push(i);
	}

	while(!q.empty()) {

		int v = q.front();
		q.pop();

		if(!live[v])
			continue;
		live[v] = false;

		int vc = (ababa[v] == 'A' ? 0 : 1);

		for(int color = 0; color < 2; ++color) {
			for(auto w : g[v].edges[color]) {

				if(v == w)
					continue;
				if(!live[w])
					continue;

				g[w].count[vc] -= 1;
				if(g[w].count[vc] <= 0)
					q.push(w);
			}
		}
	}

	bool ok = false;

	for(auto l : live)
		ok = ok || l;

	printf("%s\n", ok ? "Yes" : "No");

	return 0;
}

/* waffle */


Measured memory_bytes: 18816
cards = [[False for i in range(13)] for j in range(4)]
pattern = ["S", "H", "C", "D"]
n = int(input())
for i in range(n):
    ch, rank = input().split()
    cards[pattern.index(ch)][int(rank)-1] = True

for i in range(4):
    for j in range(13):
        if cards[i][j] == False:
            print(pattern[i]+" "+str(j+1))


Measured memory_bytes: 5604
import java.util.Scanner;
public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int taro = 0;
        int hanako = 0;
        
        for(int i = 0; i < n; i++){
            String tc = sc.next();
            String hc = sc.next();
            int com = tc.compareTo(hc);
            
            if(com == 0){
                taro++;
                hanako++;
            }else if(com < 0){
                hanako += 3;
            }else{
                taro +=3;
            }
        }
        System.out.println(taro + " " + hanako);
    }
}


Measured memory_bytes: 29376
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
 
using namespace __gnu_pbds;
using namespace std;
#define ll long long
#define hii cout << "hii" << endl
#define int ll
#define endl '\n'
#define all(s) s.begin(), s.end()
 
template <class T> ostream& operator << (ostream &os, const vector<T> &v) { for (T i : v) os << i << ' '; return os; }
template <class T> ostream& operator << (ostream &os, const set<T> &v) { for (T i : v) os << i << ' '; return os; }
template <class T, class S> ostream& operator << (ostream &os, const pair<T, S> &v) { os << v.first << ' ' << v.second; return os; }
template <class T, class S> ostream& operator << (ostream &os, const unordered_map<T, S> &v) { for (auto i : v) os << '(' << i.first << "=>" << i.second << ')' << ' '; return os; } 
 
 
#ifndef ONLINE_JUDGE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
    template <class Arg1> void __f(const char* name, Arg1&& arg1) { cerr << name << " : " << arg1 << endl; }
    template <class Arg1, class... Args>
    void __f(const char* names, Arg1&& arg1, Args&&... args) {
        const char* sep = strchr(names + 1, ',');
        cerr.write(names, sep - names) << " : " << arg1 << "  ";
        __f(sep + 1, args...);
    }
#else
#define trace(...) 0
#pragma GCC optimize ("O3")
#pragma GCC optimize ("unroll-loops")
#pragma GCC target("avx2,sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define _CRT_SECURE_NO_WARNINGS
#endif // ifndef ONLINE_JUDGE
 
 
const int N = 3e5 + 5;
const int MAXN = 1e5 + 5;
const int M = 1e5;
const int mod = 998244353;
const int MOD = 998244353;
const int INF = 1e15;
const int LG = 21;

int arr[N];
int query = 1;
 


void print(int ret)
{
    cout << "Case #" << query++ << ": " << ret << endl;
}

void solve() 
{
	int k, a, b;
	cin >> k >> a >> b;
	for(int i = a; i <= b; i++)
	{
		if(i % k == 0)
		{
			cout << "OK" << endl;
			return;
		}
	}
	cout << "NG" << endl;
}

 
 
int32_t main() 
{	
    ios_base:: sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	    int t = 1;
	    // cin >> t;
	while(t--)solve();
	return 0;
}

Measured memory_bytes: 3636
#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <string>
#include <cstring>
#include <algorithm>
using namespace std;



int main() {

    ios::sync_with_stdio(false);
    cin.tie(NULL);

    long long a, b, c;
    cin >> a >> b >> c;

    long long k;
    cin >> k;

    if (k%2) {
        cout << (b-a) << endl;
    } else {
        cout << (a-b) << endl;
    }

    return 0;
}


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

using namespace std;

#define rep(i, n) for(int i = 0; i < n; i++)
#define repn(i, n) for(int i = 1; i <= n; i++)
#define repr(i, n) for(int i = n-1; i >= 0; i--)
#define all(x) (x).begin(), (x).end()
#define lint long long


int main(){
    int a, b; cin >> a >> b; a--; b--;
    cout << 100 << " " << 100 << endl;
    rep(i, 100){
        string res = "";
        rep(j, 100){
            if(i < 50){
                if(i % 2 == 1 || j % 2 == 1) res += "#";
                else{
                    if(a == 0) res += "#";
                    else{
                        res += ".";
                        a--;
                    }
                }
            }
            else{
                if(i % 2 == 0 || j % 2 == 1) res += ".";
                else{
                    if(b == 0) res += ".";
                    else{
                        res += "#";
                        b--;
                    }
                }
            }
        }
        cout << res << endl;
    }
}

Measured memory_bytes: 888
import bisect
import os
from collections import Counter, deque
from fractions import gcd
from functools import lru_cache
from functools import reduce
import functools
import heapq
import itertools
import math
import numpy as np
import re
import sys

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(2147483647)
INF = float("inf")

S = sys.stdin.readline().rstrip()
if 'AC' in S:
    print('Yes')
else:
    print('No')


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

using namespace std;

#define int long long
#define ar array



int32_t main()
{
  ios::sync_with_stdio(0);
  cin.tie(0);

  int n,d,cnt=0;
  cin >> n >> d;
  for(int i = 0,a,b;i < (int)n; i++){
    cin >> a >> b;  
    int x = a*a + b*b;
    //x = sqrt(x);
    if(x<=(d*d)) cnt++;
  }  
  cout << cnt;
    
  return 0;
}


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

const ll mod=1e9+7;

ll add(ll x, ll y) { return (x+y+mod)%mod; }

void solve() 
{
    ll n, k; cin>>n>>k;
    ll a[n];
    for(ll i=0; i<n; i++) cin>>a[i];
    ll ans=0;
    for(ll i=0; i<n; i++)
    {   
        ll x=0;
        for(ll j=i+1; j<n; j++) if(a[i] > a[j]) x++;
        ll y=0;
        for(ll j=0; j<n; j++) if(j!=i and a[j]>a[i]) y++;
        ans=add(ans, (x*k)%mod);
        ll t = (((k*(k-1)/2)%mod)*y)%mod;
        ans=add(ans, t);
    }
    cout<<ans<<endl;
} 
 
int main() {
	ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);  
	ll T = 1; 
	//cin>>T;   
	while(T--)
	    solve();
	return 0;
}


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

using namespace std;

typedef pair<int, int> PII;
typedef long long ll;

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define pct __builtin_popcount

#define N 100010

int a[N]; bool f[N]; 
int n, m; 

int main () {
	cin >> n >> m;
	for (int i = 0; i < n; i ++) a[i] = 1;
	f[0] = 1;
	while (m--) {
		int x, y;
		cin >> x >> y;
		-- x; -- y;
		a[x] --; a[y] ++;
		if (f[x]) {
			f[y] = 1;
			if (!a[x]) f[x] = 0;
		}
	}
	int S = 0;
	for (int i = 0; i < n; i ++)
		if (f[i]) S ++;
	cout << S << endl;
	return 0;
}

Measured memory_bytes: 768