akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define Mid ((l+r)/2)
#define rep(i,a,b) for(int i=(a);i<=(b);++i)
#define drep(i,a,b) for(int i=(a);i>=(b);--i)
#define file(a) freopen(#a".in","r",stdin),freopen(#a".out","w",stdout);
const int maxn=1e5+5,mod=1e9+7,inf=0x3f3f3f3f;
int n,m,Q,K,T;
int read(){
    int x=0,f=1;char c=getchar();
    while(c<'0'||c>'9'){if(c=='-')f=-1;c=getchar();}
    while(c>='0'&&c<='9'){x=x*10+c-'0';c=getchar();}
    return x*f;
}char c[maxn];
int q[maxn];
signed main(){
    //file(a);
    scanf("%s",c+1);
    int res=0;
    rep(i,1,3){
        if(c[i]=='R'){
            int ans=0;
            rep(j,i,3){
                if(c[j]=='R')++ans;
                else break;
            }res=max(res,ans);
        }
    }printf("%d\n",res);

    return 0;
}


Measured memory_bytes: 3812
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using V = vector<int>;
using VV = vector<vector<int>>;
using VVV = vector<vector<vector<int>>>;
using VL = vector<ll>;
using VVL = vector<vector<ll>>;
using VVVL = vector<vector<vector<ll>>>;
using pq = priority_queue<int>;
template<class T>
using P = pair<T, T>;
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep1(i,n) for(int i=1;i<=(n);i++)
#define REP(i,k,n) for(int i=(k);i<(n);i++)
#define all(a) (a).begin(),(a).end()
#define output(x,y) cout << fixed << setprecision(y) << x << endl;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
int under = (1 << 31);
int upper = under - 1;
ll UNDER = (1LL << 63);
ll UPPER = UNDER - 1;
const int MOD = 1e9 + 7;
const long double pi = 3.141592653589793;
int main() {
	int n, m;
	cin >> n >> m;
	rep(i, n + 1) rep(j, n + 1 - i) {
		int tmp = i * 10000 + j * 5000;
		int tmp2 = n - (i + j);
		if ((m - tmp) / 1000 == tmp2) {
			printf("%d %d %d\n", i, j, tmp2);
			return 0;
		}
	}
	printf("%d %d %d\n", -1, -1, -1);
	return 0;
}

Measured memory_bytes: 256
//
//  main.c
//  ITP1_8_C
//
//  Created by k16031kk on 2018/05/26.
//  Copyright © 2018年 AIT. All rights reserved.
//

#include <stdio.h>

int main(int argc, const char * argv[]) {
    // insert code here...
    char str;
    int count[26];
    int num=0;
    
    for(int i=0; i<26; i++) {
        count[i]=0;
    }
    
    while(scanf("%c", &str) != EOF) {
        //if(str=='\n') break;
        num=str-'a';
        if(num<0) num+=32;
        //printf("%d ",num);
        count[num]++;
    }
    for(int i=0; i<26; i++) {
        printf("%c : %d\n", i+'a', count[i]);
    }
    return 0;
}



Measured memory_bytes: 2040
import java.util.Scanner;

public class Main{
  public static void main(String[] args) {
    Scanner Str = new Scanner(System.in);
  	int a = Integer.parseInt(Str.next());
  	int b = Integer.parseInt(Str.next());
  	if(Math.floor(a / 10) + Math.floor(b / 10) == 0){
    	System.out.println(a*b); 
  	}else{
   	 System.out.println("-1"); 
 	}  
  }
}

Measured memory_bytes: 23124
#include<bits/stdc++.h>
#define ll long long
#define dbl double
#define forn(i,n,k) for(int i=0;i<n;i=i+k)
#define forpn(p,n,k) for(int i=p;i<n;i+=k)
#define for0(i,n) for(int i=0;i<n;i++)
#define for1(i,n) for(int i=1;i<=n;i++)
#define vi vector<int>
#define vii vector<pair<int,int>>
#define all(x) (x).begin,(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define pb push_back
using namespace std;
vector<ll> v;
int no_of_bits(long long n)
{
    int count=0;
    while(n>0)
    {
        n=n>>1;
        count++;
    }
    return count;
}
long long gcd(int a,int b)
{
    if(b==0) return a;
    else return gcd(b,a%b);
}
bool isPrime(int n) {
    
    if (n == 1) {
        return false;
    }

    int i = 2;
  
    while (i*i <= n) {
        
        if (n % i == 0) {
            
            return false;
        }
        i += 1;
    }
    
    return true;
}
void primeFactors(ll n)  
{  int count=0;
    while (n % 2 == 0)  
    {  count++;
          
        n = n/2;  
    }  
    v.push_back(count);
      
    for (int i = 3; i <= sqrt(n); i = i + 2)  
    {  
          count=0;
        while (n % i == 0)  
        {  
          count++;
            n = n/i;  
        }  
        if(count!=0) v.pb(count);
    }  
  
     
    if (n > 2)  
        v.push_back(1);  
} 
void solve(){
     ll n;
     cin>>n;
     primeFactors(n);
     int sum=0,count=1;
     for(int i=0;i<v.size();i++){
         count=1;
         while(v[i]>0){
             sum+=1;
             v[i]-=count;
             count++;
         }
         if(v[i]<0) sum--;
         
         
     }
     cout<<sum<<endl;
}
int main()
{   ios::sync_with_stdio(0);
    
    cin.tie(0);
    cout.tie(0);
    int p;
    p=1;
    while(p--)
    {
       solve();
    }
    return 0;
}


Measured memory_bytes: 3700
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <inttypes.h>
#include <stdint.h>
#include <string.h>
#include <wchar.h>

#define MIN(a, b) (a < b ? a : b)
#define MAX(a, b) (a > b ? a : b)
#define ABSS(a, b) (a > b ? a - b : b - a)

char S[100][101];

int compare_str(const void *a, const void *b) {
	return strcmp(*(char **)a, *(char **)b);
}

int main(void) {
	uint32_t N, L;
	char * sortedList[100];

	scanf("%"PRIu32" %"PRIu32"\n", &N, &L);
	for (uint32_t idx = 0; idx < N; idx++) {
		scanf((idx != N - 1 ? "%s\n" : "%s"), S[idx]);
		sortedList[idx] = S[idx];
	}

	qsort(sortedList, N, sizeof(char *), compare_str);

	for (uint32_t idx = 0; idx < N; idx++) {
		printf("%s", sortedList[idx]);
	}

	return 0;
}


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

using namespace std;

const double EPS = 1e-11;

int main() {
	complex<double> p[4], a, b;
	double x, y;
	int n;
	cin >> n;
	for(int i = 0;i < n;++i) {
		for(int j = 0;j < 4;++j) {
			cin >> x >> y;
			p[j].real(x);
			p[j].imag(y);
		}
		a = p[1] - p[0];
		b = p[3] - p[2];
		double dot = real(conj(a) * b);
		if(signbit(dot)) dot *= -1.;
		cout << (abs(dot - (abs(a) * abs(b))) < EPS ? "YES" : "NO") << endl;
	}
	return 0;
}



Measured memory_bytes: 3288
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <utility>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <limits>
#include <numeric>
#include <cmath>

using namespace std;

template<class T>
class Input {
public:
    auto operator()() const {
        T v;
        cin >> v;
        return v;
    }
};

template<class L, class R>
class Input<pair<L, R>> {
public:
    auto operator()() const {
        L l;
        R r;
        cin >> l >> r;
        return make_pair(l, r);
    }
};

template<class U>
class Input<vector<U>> {
public:
    auto operator()() const {
        Input<size_t> in{};
        auto n = in();
        return (*this)(n);
    }
    auto operator()(size_t n) const {
        vector<U> v;
        v.reserve(n);
        Input<U> in{};
        for (size_t i = 0; i < n; ++i) {
            auto u = in();
            v.emplace_back(move(u));
        }
        return v;
    }
};

template<class U>
class Input<vector<vector<U>>> {
public:
    auto operator()() const {
        Input<size_t> in{};
        auto n = in();
        auto m = in();
        return (*this)(n, m);
    }
    auto operator()(size_t n, size_t m) const {
        vector<vector<U>> v;
        v.reserve(n);
        Input<vector<U>> in{};
        for (size_t i = 0; i < n; ++i) {
            auto u = in(m);
            v.emplace_back(move(u));
        }
        return v;
    }
};

class InputType
{
public:
    template<class T>
    operator T() const {
        Input<T> i{};
        return i();
    }
};

class InputType2
{
public:
    InputType2(size_t n)
        : n_(n)
    {}
    template<class T>
    operator T() const {
        Input<T> i{};
        return i(n_);
    }
private:
    size_t n_;
};

auto input() {
    return InputType();
}

template<class... Args>
auto input(Args&&... args) {
    return InputType2(std::forward<Args>(args)...);
}

size_t bitcount(size_t n) {
    size_t c = 0;
    while (n) {
        if (n & 1ull)
            ++c;
        n >>= 1;
    }
    return c;
}

auto make_order(size_t n) {
    vector<size_t> a(n, 0);
    iota(begin(a), end(a), 0);
    return a;
}

template<class T>
auto next_permutation(T&& x) {
    using std::begin;
    using std::end;
    return next_permutation(begin(x), end(x));
}

using ll = long long;
using ull = unsigned long long;

int main() {
    ll n = input();
    ll k = input();
    while (true) {
        auto a = n / k;
        auto b = abs(n - a * k);
        auto c = abs(n - (a + 1) * k);
        ll v = 0;
        if (b < c)
            v = b;
        else
            v = c;
        if (v >= n)
            break;
        n = v;
    }
    cout << n << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define endl "\n"
using namespace std;
typedef long long ll;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
template<class T>
inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}

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

const long long INF = 1e18;
//const ll mod = 1000000007;
int N;
map<ll, ll> mp;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    for(ll i = 1; i <= 100; i++) {
        for(ll j = 1; j <= 100; j++) {
            for(ll k = 1; k <= 100; k++) {
                ll tmp = 0;
                tmp += i*i;
                tmp += j*j;
                tmp += k*k;
                tmp += i*j;
                tmp += k*j;
                tmp += i*k;
                mp[tmp]++;
            }
        }
    }
    cin >> N;
    for(int i = 1; i <= N; i++) {
        cout << mp[i] << endl;
    }
    return 0;
}


Measured memory_bytes: 6052
#include<stdio.h>
#include<stdlib.h>

struct node{
  struct node *right;
  struct node *left;
  struct node *parent;
  int key;
};
typedef struct node * Node;
#define NIL NULL

Node root;

Node treeMinimum(Node x){
  while(x->left!=NIL)
    x =x->left;
    return x;
}

Node treeMaximum(Node x){
  while(x->right != NIL)
    x = x->right;
    return x;
}

Node treeSearch(Node u, int k){
  if(u==NIL && k==u->key) return u;

  else if(k < u->key) return treeSearch(u->left,k);

  else return treeSearch(u->right,k);
  
}

Node treeSuccessor(Node x){
  Node y;
  if(x->right != NIL) return treeMinimum(x->right);
  y = x->parent;
  while(y != NIL && x == y->right){
    x = y;
    y = y->parent;
  }
  return y;

}

void treeDelete(Node z){
  Node y; // node to be deleted
  Node x; // child of y
  if(z->left==NIL || z->right==NIL) y = z;
  else y = treeSuccessor(z);

  if(y->left != NIL) x=y->left;
  else x = y->right;

  if(x!=NIL) x->parent = y->parent;
  if(y->parent==NIL) root = x;
  else if(y == y->parent->left) y->parent->left = x;
  else y->parent->right =x;
  
  if( y!= z) z->key = y->key;
}

void insert(int k){
  Node y = NIL;
  Node x = root;
  Node z;

  z = malloc(sizeof(struct node));
  z->key = k;
  z->left = NIL;
  z->right = NIL;

  while(x!=NIL){
    y = x;
    if(z->key < x->key) x = x->left;
    else x = x->right;
  }
  z->parent = y;
  if(y==NIL) root = z;
  else if(z->key < y->key) y->left = z;
  else y->right = z;
}

void inorder(Node u){
  if(u != NIL){
    inorder(u->left);
    printf(" %d",u->key);
    inorder(u->right);
  }
}
void preorder(Node u){
  if(u !=NIL){
    printf(" %d",u->key);
    preorder(u->left);
    preorder(u->right);
  }
}


int main(){
  int n, i, x;
  char com[20];
  scanf("%d", &n);

  for ( i = 0; i < n; i++ ){
    scanf("%s", com);
    if ( com[0] == 'f' ){
      scanf("%d", &x);
      Node t = treeSearch(root, x);
      if ( t != NIL ) printf("yes\n");
      else printf("no\n");
    } else if ( com[0] == 'i' ){
      scanf("%d", &x);
      insert(x);
    } else if ( com[0] == 'p' ){
      inorder(root);
      printf("\n");
      preorder(root);
      printf("\n");
    } else if ( com[0] == 'd' ){
      scanf("%d", &x);
      treeDelete(treeSearch(root, x));
    }
  }

  return 0;
}



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

typedef vector<int> vi;
#define ll long long
#define loop(i,n) for(int i=0; i<n; i++)
#define loop1(i,n) for(int i=1; i<=n; i++)
#define loopi(i,s,e) for(int i=s; i < e; i++)
#define loopiRev(i,s,e) for(int i=s; i >= e; i--)
#define PI 3.14159265359
#define x first
#define y second
#define point pair<double,double>
#define len(s)   (int)s.length()
#define sz(v)    (int)v.size()
#define all(a)   a.begin(),a.end()
#define clr(x, val)	memset((x), (val), sizeof(x))

void initialize(vector<int> &F, int n){
    F = vector<int> (n+1, 0);

    for(int i=2; i*i  <= n; i++){
        if(F[i] == 0)
            for(int k=i*i; k <=n ; k+= i)
                if(F[k] == 0) F[k] = i;
    }
}

//you don't know math, unless you can do math!
int l,n;
vector<int> cuts;
ll dp[1100][1100];

ll solve(int i, int j){
    ll &ret= dp[i][j];
    if(ret != -1)
        return ret;

    int cur= lower_bound(cuts.begin(), cuts.end(), i+1) - cuts.begin();
    if(cur == cuts.size() || cuts[cur] >= j)
        return ret= 0;



    ret= 10000000;
    while(cur < n && cuts[cur] < j){
        ret = min(ret, solve(i, cuts[cur]) + solve(cuts[cur], j) + j - i);
        cur++;
    }

    return ret;
}
int main() {
    //freopen("input.txt" , "r" , stdin) ;
    //freopen("output.txt" , "w" , stdout) ;

    cin.tie(0);
    cin.sync_with_stdio(0);

    string a,b,c;
    cin>>a>>b>>c;

    int len1=a.length(), len2=b.length();

    if(a[len1-1] == b[0] && b[len2-1] == c[0])
        cout<<"YES";
    else
        cout<<"NO";
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
char f[22][22];
int dx[4]={0,0,1,-1};
int dy[4]={1,-1,0,0}; 
int w,h,sx,sy;
void dfs(int x,int y)
{
	if(f[x][y]!='.')return;
	f[x][y]='7';
	for(int i=0;i<4;i++)
	{
		int nx = x + dx[i];
		int ny = y + dy[i];
		if(nx<0||nx>=h||ny<0||ny>=w)continue;
		if(f[nx][ny]!='.')continue;
		dfs(nx,ny);
	}
	return;
}
int main()
{
	while(1)
	{
		cin >> w >> h;
		if(w==0&&h==0)break;
		for(int i=0;i<h;i++)
		{
			for(int j=0;j<w;j++)
			{
				cin >> f[i][j];
				if(f[i][j]=='@')
				{
					sx = i;
					sy = j;
					f[i][j]='.';
				}
			}
		}
		dfs(sx,sy);
		int ans = 0;
		for(int i=0;i<h;i++)
		{
			for(int j=0;j<w;j++)
			{
				if(f[i][j]=='7')ans++;
			}
		}
		cout << ans << endl;
	}
	return 0;
}

Measured memory_bytes: 1164
N,D=map(int,input().split())
X=[]
m=0
for i in range(N):
    X1=list(map(int,input().split()))
    X.append(X1)
for i in range(N-1):
    for j in range(i+1,N):
        sum1=0
        for k in range(D):
            sum1=sum1+(X[i][k]-X[j][k])**2
        sum2=sum1**(1/2)
        if sum2==int(sum2):
            m=m+1
print(m)


Measured memory_bytes: 3064
#include<stdio.h>
int main()
{
	int a,b;
	int x;
	scanf("%d %d",&a,&b);
	if(a==0) x=1;
	else if(a==1) x=100;
	else x=10000;
	if(b<100) printf("%d",b*x);
	else printf("%d",(b+1)*x);
	return 0;
}

Measured memory_bytes: 128
#include<iostream>
#include<string.h>
using namespace std;

int main()
{
  int j=0;
  string s1,s2;
  getline(cin,s1);
  getline(cin,s2);
  for(int i=0;i<s1.length()||i<s2.length();i++)
    if(s1[i]!=s2[i])
      j++;
  cout<<j;
  return 0;
}

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

int main()
{
    double a,b,x,v,w,k,A;
    cin>>a>>b>>x;
    v=a*a*b;
    w=a*a;
    if(x>=v/2)
    {
        k=2*(b-(x/w));
        A=k/a;
    }
    
    else
    {
        k=(2*x/(a*b));
        A=b/k;
    }
    double h=atan(A)*180/3.14159265;
    cout<<fixed<<setprecision(6)<<h;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<vector>
#include<algorithm>
using namespace std;
int main()
{
	int mx, my, a, b;
	scanf("%d%d%d%d", &mx, &my, &a, &b);
	for (int i = 0; i < mx; i++)
	{
		for (int j = 0; j < my; j++)
		{
			if ((i < b) == (j < a))printf("0");
			else printf("1");
		}
		printf("\n");
	}
}

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

int main(){
  int N,K,Q;
  cin >> N >> K >> Q;
  vector<int> HP(N,K-Q);
  for(int i=0;i<Q;i++){
    int A;
    cin >> A;
    HP.at(A-1)++;
  }
  for(int i=0;i<N;i++){
   if(HP.at(i)>0){
      cout << "Yes" << endl;
    }
    else{
      cout << "No" << endl;
    }
  }
}

Measured memory_bytes: 3800
#include <bits/stdc++.h>
#define F first
#define S second
#define PB push_back
#define ALL(a) a.begin(), a.end()
#define REP(i,a) for(ll i(0), _##i(a); i < _##i; ++i)
#define FOR(i,a,b) for(ll i(a), _##i(b); i <= _##i; ++i)
using namespace std;
using ll = long long;

const int INF = 1e9;
int n, k, ans = INF;
vector<int> a;

void bt(int id, int num){
    if (id > 6) return;
    if (num >= n){
        ans = min(ans, num);
        return;
    }
    for(int x : a){
        bt(id + 1, num * 10 + x);
    }
}

void solve(){
    cin >> n >> k;
    a.resize(k);
    for(int &x : a) cin >> x;
    vector<int> b;
    FOR(i,0,9) {
        if (find(ALL(a), i) == a.end()){
            b.PB(i);
        }
    }
    swap(a, b);
    bt(0, 0);
    cout << ans << "\n";
}

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

    int T = 1;
    //cin >> T;
    FOR(i,1,T){
        solve();
    }
}


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

using namespace std;

int main(){
    int n;
    cin>>n;
    int i=n/111;
    if (n%111==0) {
        cout<<n<<endl;
    }else{
        cout<<(i+1)*111<<endl;
    }
    return 0;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.*;


public class Main {

    public static void main(String[] args) throws IOException {
        Scanner s = new Scanner(System.in);
        int i=1;
        while(i<=5){
            if(s.nextInt()==0){
                System.out.println(i);
                break;
            }
            i++;
        }



    }

}




class Scanner
{
    StringTokenizer st;
    BufferedReader br;

    public Scanner(InputStream s){	br = new BufferedReader(new InputStreamReader(s));}

    public String next() throws IOException
    {
        while (st == null || !st.hasMoreTokens())
            st = new StringTokenizer(br.readLine());
        return st.nextToken();
    }

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

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

    public String nextLine() throws IOException {return br.readLine();}

    public double nextDouble() throws IOException
    {
        String x = next();
        StringBuilder sb = new StringBuilder("0");
        double res = 0, f = 1;
        boolean dec = false, neg = false;
        int start = 0;
        if(x.charAt(0) == '-')
        {
            neg = true;
            start++;
        }
        for(int i = start; i < x.length(); i++)
            if(x.charAt(i) == '.')
            {
                res = Long.parseLong(sb.toString());
                sb = new StringBuilder("0");
                dec = true;
            }
            else
            {
                sb.append(x.charAt(i));
                if(dec)
                    f *= 10;
            }
        res += Long.parseLong(sb.toString()) / f;
        return res * (neg?-1:1);
    }

    public boolean ready() throws IOException {return br.ready();}


}

Measured memory_bytes: 25236
def judge(card_a, card_b):
    if card_a == card_b:
        return 1, 1
    elif card_a < card_b:
        return 0, 3
    else:
        return 3, 0


if __name__ == "__main__":
    num_turns = int(input())

    pair_cards = []

    for _ in range(num_turns):
        pair_cards.append(input().split())

    scores = list(map(lambda pair: judge(*pair), pair_cards))

    total_score = list(map(sum, zip(*scores)))

    print(' '.join(map(str, total_score)))


Measured memory_bytes: 5876
x = input().split()
a = float(x[0])
b = float(x[1])
la = len(x[0])
lb = len(x[1])
if a < 0 and b > 0:
  a = int(x[0][1:la])
  b = int(b)
  p = - a + b
  m = - a - b
  k = - a * b
elif b < 0 and a > 0:
  a = int(a)
  b = int(x[1][1:lb])
  p = a - b
  m = a + b
  k = a * - b
elif a< 0 and b < 0:
  a = int(x[0][1:la])
  b = int(x[1][1:lb])
  p = - a - b
  m = - a + b
  k = a * b
else:
  a = int(x[0])
  b = int(x[1])
  p = a + b
  m = a - b
  k = a * b
if p >= m and p >= k:
  print(p)
elif m >= p and m >= k:
  print(m)
elif k >= p and k >= m:
  print(k)

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

using namespace std;
int main()
{
    int n;
    cin>>n;
    int a[200001];
    for(int i=0;i<n;i++)
        cin>>a[i];
    int cnt[200001]={0};
    long long  num[200001]={0};
    for(int i=0;i<n;i++)
    {
           int t=a[i];
           cnt[t]++;
    }
    for(int i=1;i<=n;i++)
    {
        for(int j=1;j<cnt[i];j++)
            num[i]+=j;
    }
    long long  s=0;
    for(int i=1;i<=n;i++)
    {
        s+=num[i];
    }
    for(int i=0;i<n;i++)
    {
        int t=a[i];
        cout<<s-cnt[t]+1<<endl;
    }
}

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

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

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

int main(){
    ll a, b, c;
    cin >> a >> b >> c;
    ll g = gcd(a, b);
    
    if(c % g != 0) cout << "NO" << endl;
    else cout << "YES" << endl; 
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#define ll long long
using namespace std;
int main()
{
  ios_base::sync_with_stdio(0);
  ll n;
  cin >> n;
  ll temp = n/15;
  ll total = n*800;
  ll returnval = temp*200;
  ll answer = total-returnval;
  cout << answer << endl;
  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main(){
  int n,m,i,j,k;
  while(scanf("%d %d",&n,&m),n){
    int d[110][110][4]={};
    d[1][1][0]=d[1][1][1]=1;
    for(i=0;i<n;i++){
      for(j=0;j<m;j++){
	d[i+1][j+1][0]+=d[i+1][j][3];
	d[i+1][j+1][1]+=d[i][j+1][2];
	d[i+1][j+1][2]+=d[i+1][j][0]+d[i+1][j][2];
	d[i+1][j+1][3]+=d[i][j+1][1]+d[i][j+1][3];
	for(k=0;k<4;k++)d[i+1][j+1][k]%=100000;
      }
    }
    for(k=1;k<4;k++)d[n][m][0]+=d[n][m][k];
    printf("%d\n",d[n][m][0]%100000);
  }
  return 0;
}

Measured memory_bytes: 796
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
#define rep(i, n) for(int i = 0; i < (int)(n); ++i)
#define rrep(i, n) for(int i = (int)(n); i>=0; --i)
struct fast_ios { fast_ios(){cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20);} } fast_ios_;

int main()
{
    ll A, B, N;
    cin >> A >> B >> N;
    ll mx = A*(min(B-1, N))/B;

    // for(ll x=B-1;x<=N;++x)
    // {
    //     ll a = floorf64x(A*x/B) - A*floorf64x(x/B);
    //     mx = max(mx, a);
    // }
    cout << mx << endl;
    return 0;
}

Measured memory_bytes: 3616
#include<iostream>
using namespace std;
int main() {
    int n, flag, cnt=0;
    cin >> n;
    int A[n];
    for (int i=0; i<n; i++){
        cin >> A[i];
    }
    flag = 1;
    while (flag){
        flag = 0;
        for (int j=n-1; j>0; j--){
            if (A[j] < A[j-1]){
                swap(A[j], A[j-1]);
                flag = 1;
                cnt += 1;
            }
        }
    }
    for (int i=0; i<n; i++){
        if (i==n-1){
            cout << A[i] << endl;
        } else {
            cout << A[i] << " ";
        }
    }
    cout << cnt << endl;
    return 0;
}


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

const int N = 2e5+10;
vector<vector<int>> G(N);
bool visited[N];
vector<int> out; //トポロジカル順序

void dfs(int u){
  visited[u] = true;
  for(int v : G[u]){
    if(!visited[v]) dfs(v);
  }
  out.push_back(u);
}
void tsort(int n){
  for(int i = 1; i <= n; i++){
    if(!visited[i]) dfs(i);
  }
  reverse(out.begin(),out.end());
}

//https://atcoder.jp/contests/nikkei2019-qual/tasks/nikkei2019_qual_d
signed main(){

  int n,m; cin >> n >> m;
  for(int i = 0; i < n-1+m; i++){
    int a,b; cin >> a >> b;
    G[a].push_back(b);
  }
  tsort(n);

  vector<int> dp(n+1,0); //根からの距離
  vector<int> ans(n+1,0);
  for(int i = 0; i < n; i++){
    for(int v : G[out[i]]){
      if(dp[v] < dp[out[i]]+1){
        dp[v] = dp[out[i]]+1;
        ans[v] = out[i];
      }
    }
  }

  for(int i = 1; i <= n; i++){
    cout << ans[i] << endl;
  }

  return 0;
}


Measured memory_bytes: 14448
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
#define f first
#define s second
typedef pair<ll,ll> plii;
int main()
{
	std::ios_base::sync_with_stdio(0);
	int n,d,a;
	cin>>n>>d>>a;
	vector<plii> monsters;
	for(int i=0;i<n;i++){
		ll x,h;
		cin>>x>>h;
		monsters.push_back({x,h});
	}
	sort(monsters.begin(),monsters.end());
    ll running_sum=0,ans=0;
    vector<ll> diff(n+1);
    for(int i=0;i<n;i++){
    	running_sum+=diff[i];
    	if(monsters[i].s>1LL*a*running_sum){
    		int r=upper_bound(monsters.begin(),monsters.end(),make_pair((ll)monsters[i].f + 2*d,1LL<<62))-monsters.begin();
    	    r--;
    	    ll bomb_req=ceil((monsters[i].s-a*running_sum)/(1.0*a));
    	    running_sum+=bomb_req;
    		diff[r+1]-=bomb_req;
    		ans+=bomb_req;
    	}
    }
    cout<<ans<<"\n";
}

Measured memory_bytes: 6128
#include <stdio.h>

using namespace std;

int main(){
    int a,b;
    while(true){
        scanf("%d %d", &a, &b);
        if(a == 0 && b == 0) {
            break;
        }
        if(a > b) {
            printf("%d %d\n",b,a);
        } else {
            printf("%d %d\n",a,b);
        }
    }
}



Measured memory_bytes: 2716
"""
第5回 ドワンゴからの挑戦状 予選  B - Sum AND Subarrays

考えたこと
N <= 1000なので、部分列の美しさは全列挙できる
美しさをK個選んで来た時のそれらの論理積　→　bitごとに計算すればOK

K個選ぶ場合の数が多いので間に合わない　→　全体についてどのbitが立っているか見ていってK以上個立ってるbitから上位K個をえらんだらいけるか？
・「K以上個立ってるbitから上位K個をえらんだら」　←ちゃんと選んだ美しさについて論理積とる。残ったりするbitがあるかもなので
"""


N,K = map(int, input().split())
A = list(map(int, input().split()))

cm = [0] * N
cm[0] = A[0]
for i in range(1,N):
    cm[i] = cm[i-1] + A[i]

B = []
for l in range(N):
    for r in range(l,N):
        if l == 0:
            B.append(cm[r])
        else:
            B.append(cm[r] - cm[l-1])

# 2**40 = 1.0~~ * 10**12
stack = B
nxt_stack = []
for i in range(41,-1,-1):
    cnt = 0
    nxt_stack = []
    for b in stack:
        if b & (1 << i):
            cnt += 1
            nxt_stack.append(b)

    # 採用するbitの立っていない物は捨てる    
    if cnt >= K:
        stack = nxt_stack


ans = 0
if len(stack) >= K:
    for i in range(K):
        if i == 0:
            ans = stack[0]
        else:
            ans &= stack[i]

print(ans)

Measured memory_bytes: 66044
#[allow(unused_imports)]
use std::cmp::*;
#[allow(unused_imports)]
use std::collections::*;
#[allow(unused_imports)]
use std::iter::*;
#[allow(unused_imports)]
use std::*;

macro_rules! test {
    ($($input:expr => $output:expr),* $(,)*) => {
#[test]
        fn solve_test() {
            $(
                assert_eq!(solve($input), $output);
            )*
        }
    };
}
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let mut s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

macro_rules! stdin {
    () => {{
        use std::io::Read;
        let mut s = String::new();
        std::io::stdin().read_to_string(&mut s).unwrap();
        s
    }};
}

fn main() {
    println!("{}", solve(&stdin!()));
}
fn solve(src: &str) -> String {
    input! {
        source = src,
        n:usize,
    }
    let m = n % 1000;
    if m == 0 {
        m.to_string()
    } else {
        (1000 - m).to_string()
    }
}
test! {
    "1900" => "100",
    "3000" => "0",
}


Measured memory_bytes: 2164
#include <cstdio>
#include <iostream>

using namespace std;

int main()
{
	int n;
	int num, pt;
	int d1, d2;

	while (scanf("%d", &n), n != 0){
		int max_n, max_pt = 0;

	    for (int i = 0; i < n; i++){
		    scanf("%d%d%d", &num, &d1, &d2);
		    pt = d1 + d2;
		    if (max_pt < pt){
				max_n = num;
				max_pt = pt;
			}
	    } 
	   	cout << max_n << " " << max_pt << endl;
	}

	return (0);
}

Measured memory_bytes: 1208
# include <bits/stdc++.h>
# define sz(x) (int)((x).size())
# define F first
# define S second
# define pb push_back
# define ub upper_bound
# define lb lower_bound
# define all(x) x.begin(), x.end()
# define pqueue priority_queue
# define mset multiset
# define umap unordered_map
# define Speed() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
# define rep(i,n) for(int i=0;i<n;++i)
# define forn(i,n) for(int i=1;i<=n;++i)
# define lr(i,l,r) for(int i=l;(l>r?i>=r:i<=r);(l>r?--i:++i))

using namespace std;

template<class T> void umin(T &a,T b){a=min(a,b);}
template<class T> void umax(T &a,T b){a=max(a,b);}

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

const int dx[]={1,0,-1,0,-1,-1,1,1},dy[]={0,1,0,-1,-1,1,-1,1}; 
const int mod = 1e9+7;
const ll N = 1e5+4;

int n,m,p[N],y[N],cnt[N],has[N];
string that[N];
vector<int>g[N];

string make(int n){
	string s="000000";
	string g="";
	while(n){
		g+=char(n%10+'0');
		n/=10;
	}
	reverse(all(g));
	s+=g;
	return s.substr(sz(s)-6,6);
}

void solve(){
	cin>>n>>m;
	vector<pii>v;
	forn(i,m){
		cin>>p[i]>>y[i];
		g[p[i]].pb(y[i]);
	}
	forn(i,n){
		sort(all(g[i]));
	}
	forn(i,m){
		if(!has[p[i]]){
			that[p[i]]=make(p[i]);
			has[p[i]]=1;
		}
		cout<<that[p[i]];
		cout<<make(lb(all(g[p[i]]),y[i])-g[p[i]].begin()+1);
		cout<<'\n';
	}
}

int main(){
	Speed();
	int T=1; 
	//cin>>T;	
	while(T--)
		solve();
	return 0;
}

Measured memory_bytes: 13260
#include <stdio.h>
#define MAX 10000
#define NIL -1


typedef struct {
  int parent;
  int left;
  int right;
}Node;


Node t[MAX];
int n, D[MAX], H[MAX];


void sDep(int u,int d) {
  if(u == NIL){
    return;
  }
  D[u] = d;
  sDep(t[u].left, d+1);
  sDep(t[u].right,d+1);
}


int sHei(int u) {
  int h1 = 0, h2 = 0;
  if(t[u].left != NIL)
    h1 = sHei(t[u].left) + 1;
  if(t[u].right != NIL)
    h2 = sHei(t[u].right) + 1;
  return H[u] = (h1 > h2 ? h1 : h2);
}


int gSib(int u) {
  if( t[u].parent == NIL ){
    return NIL;
  }
  if(t[t[u].parent].left != u && t[t[u].parent].left != NIL ){
    return t[t[u].parent].left;
  }
  if(t[t[u].parent].right != u && t[t[u].parent].right != NIL ){
    return t[t[u].parent].right;
  }
  return NIL;
}


void print(int u) {
  printf("node %d: ",u);
  printf("parent = %d, ",t[u].parent);
  printf("sibling = %d, ",gSib(u));
  int deg = 0;
  if(t[u].left  != NIL) deg++;
  if(t[u].right != NIL) deg++;
  printf("degree = %d, ",deg);
  printf("depth = %d, ",D[u]);
  printf("height = %d, ",H[u]);
  
  if(t[u].parent == NIL) {
    printf("root\n");
  } else if(t[u].left == NIL && t[u].right == NIL) {
    printf("leaf\n");
  } else {
    printf("internal node\n");
  }
}





int main(void) {
  int v, l, r, root = 0;
  scanf("%d",&n);
  for(int i=0;i<n;i++){
    t[i].parent = NIL;
  }
  for(int i=0;i<n;i++){
    scanf("%d %d %d",&v,&l,&r);
    t[v].left  = l;
    t[v].right = r;
    if(l != NIL) t[l].parent = v;
    if(r != NIL) t[r].parent = v;
  }



  
  for(int i=0; i<n; i++)
  if(t[i].parent == NIL) root = i;

  
  sDep(root,0);
  sHei(root);

  
  for(int i=0;i<n;i++){
    print(i);
  }
  
  return 0;
}


Measured memory_bytes: 2068
N, K = list(map(int, input().split()))
X = list(map(int, input().split()))

cost_min = 999999999

for i in range(N-K+1):
    if X[i] < 0 and X[i+K-1] < 0:
        cost_tmp = abs(X[i])
    elif X[i] > 0 and X[i+K-1] > 0:
        cost_tmp = X[i+K-1]
    else:
        cost_tmp = min(X[i+K-1]-X[i]*2, X[i+K-1]*2- X[i])
    if cost_tmp <= cost_min:
        cost_min = cost_tmp

print(cost_min)

Measured memory_bytes: 14224
{-# LANGUAGE MultiWayIf #-}

import qualified Data.ByteString.Char8 as B
import Data.Char (isSpace)
import Data.List (unfoldr)
import Data.Bits (shiftR)

readInt = B.readInt . B.dropWhile isSpace
readInts = unfoldr readInt

inf = 10000

a#b = abs (a-b)

solv :: Int -> Int -> Int -> [Int] -> Int
solv a b c ls = go ls (0,0,0) 0 where
  go [] (la,lb,lc) cost
    | la==0 || lb==0 || lc==0 = inf
    | otherwise = cost + a#la + b#lb + c#lc
  go (l:ls) (la,lb,lc) cost = minimum [forA, forB, forC, unuse] where
    halfl = shiftR l 1
    forA = if
      | la/=0 && la#a < halfl -> inf
      | otherwise -> go ls (la+l, lb, lc) $ if la>0 then cost+10 else cost
    forB = if
      | lb/=0 && lb#b < halfl -> inf
      | otherwise -> go ls (la, lb+l, lc) $ if lb>0 then cost+10 else cost
    forC = if
      | lc/=0 && lc#c < halfl -> inf
      | otherwise -> go ls (la, lb, lc+l) $ if lc>0 then cost+10 else cost
    unuse = go ls (la,lb,lc) cost

main = do
  [n,a,b,c] <- readInts <$> B.getLine
  ls <- readInts <$> B.getContents
  print $ solv a b c ls


Measured memory_bytes: 892
#include <iostream>
// #include<queue>
//   #include<vector>
// // #include <cmath>
//  #include <string>
// #include <bits/stdc++.h>
using namespace std;
 
 
 
int main(){
	int a;
	cin>>a;
	int sum =a;
	sum += a*a;
	sum += a*a*a;
	cout<<sum;
	return 0;
}

Measured memory_bytes: 3624
#include<stdio.h>
#include<stdlib.h>
#define NIL NULL


struct node{
  struct node *left;
  struct node *right;
  struct node *parent;
  int key;
};
  
typedef struct node * Node;
  
Node root;

void Insert(int k){
  Node y=NIL;
  Node x=root;
  Node z;
  
  z=malloc(sizeof(struct node));
  z->key=k;
  z->left=NIL;
  z->right=NIL;
    
  while(x!=NIL){
    y=x;
  
    if(z->key<x->key){
      x=x->left;
    }
    else x=x->right;
  }
  z->parent=y;
    
  if(y==NIL){
    root=z;
  }
  else if(z->key<y->key){
    y->left=z;
  }
  else y->right=z;
}
 

  
void preorder(Node u){
  printf(" %d",u->key);
  if(u!=NIL){
    if(u->left!=NIL){
      preorder(u->left);
    }
    if(u->right!=NIL){
      preorder(u->right);
    }
  }
}
  
void inorder(Node u){
    
  if(u!=NIL){
    if(u->left!=NIL){
      inorder(u->left);
    }
    printf(" %d",u->key);
      
    if(u->right!=NIL){
      inorder(u->right);
    }
  }
}
  
void insert(int k){
  Node y=NIL;
  Node x=root;
  Node z;
  
  z=malloc(sizeof(struct node));
  z->key=k;
  z->left=NIL;
  z->right=NIL;
    
  while(x!=NIL){
    y=x;
  
    if(z->key<x->key){
      x=x->left;
    }
    else x=x->right;
  }
  z->parent=y;
    
  if(y==NIL){
    root=z;
  }
  else if(z->key<y->key){
    y->left=z;
  }
  else y->right=z;
}
  
Node Search(Node u,int k){
  if(u==NIL || k==u->key){
    return u;
  }
  if(k<u->key){
    return Search(u->left,k);
  }
  else return Search(u->right,k);
}
  
main(){
  int n, i, x;
  char str[20];
    
  scanf("%d",&n);
  
  for ( i = 0; i < n; i++ ){
    scanf("%s",str);
  
    if (str[0]=='i'){
      scanf("%d",&x);
      insert(x);
    } 
    else if (str[0]=='p'){
      inorder(root);
      printf("\n");
        
      preorder(root);
      printf("\n");
    }
    else if(str[0]=='f'){
      scanf("%d",&x);
      Node s=Search(root,x);
      if (s!= NIL ) printf("yes\n");
      else printf("no\n");
    }
  }
  return 0;
}

Measured memory_bytes: 19364
#include <bits/stdc++.h>
#define MOD (long long)(1E9+7)
#define rep(i, n) for(int i = 0; i < n; i++)

using namespace std; 

int main(){
	int y,m,d;
	scanf("%d/%d/%d", &y, &m, &d);
	if(y < 2019 || y == 2019 && m <= 4) {
      cout << "Heisei" << endl;
    } else {
      cout << "TBD" << endl;
    }
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
using namespace std;
typedef long long ll;
ll A,B;
int k=-1,s=-1;
int main()
{
    cin>>A>>B;
    for(int i=60;i>=0;i--)
    {
        if(((A>>i)&1)!=((B>>i)&1))
        {
            k=i;
            break;
        }
        else if((A>>i)&1)  A^=(1ll<<i),B^=(1ll<<i);
    }
    if(k==-1)
    {
        puts("1");
        return 0;
    }
    for(int i=k-1;i>=0;i--)
    {
        if((B>>i)&1)
        {
            s=i;
            break;
        }
    }
    if(s==-1)
    {
        cout<<(1ll<<k)-A+1+(1ll<<k)-A-(!A)<<endl;
        return 0;
    }
    if((1ll<<(s+1))-1>=A-1)
    {
        cout<<(1ll<<(k+1))-A<<endl;
    }
    else{
        cout<<(1ll<<(k+1))+(1ll<<(s+1))-2*A<<endl;
    }
    return 0;
}

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

int main(){
  int a,b,c,k,x;
  cin >> a >> b >> c >> k;
  if(a >= k){
    cout << k << endl;
  }
  else if(b >= k - a){
    cout << a << endl;
  }
  else{
    cout << a - (k - a - b) << endl;
  }
  return 0;
}


Measured memory_bytes: 3576
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ll long long
#define P pair<int,int>
#define fi first
#define se second
#define rep(i,n) for(int i=0;i<n;i++)
#define all(v) v.begin(),v.end()
#define pb push_back
template<class T>void chmax(T &a,T b){if(a<b)a=b;}
template<class T>void chmin(T &a,T b){if(a>b)a=b;}
constexpr int INF=1000000000000000000;
constexpr int mod=1000000007;
int dx[]={0,1,0,-1},dy[]={1,0,-1,0};
int gcd(int a,int b){
    if(b==0)return a;
    return gcd(b,a%b);
}
int lcm(int a,int b){
    return a/gcd(a,b)*b;
}
bool prime(int a){
    if(a==1)return false;
    for(int i=2;i*i<=a;i++){
        if(a%i==0)return false;
    }
    return true;
}
vector<int>kaijo;
void init_fact(int n){
    kaijo.resize(n+1);
    kaijo[0]=1;
    for(int i=1;i<=n;i++){
        kaijo[i]=kaijo[i-1]*i;
        kaijo[i]%=mod;
    }
}
int modpow(int a,int b){
    if(b==0)return 1;
    if(b%2)return modpow(a,b-1)*a%mod;
    int memo=modpow(a,b/2);
    return memo*memo%mod;
}
int comb(int a,int b){
    //if(!kaijo[0])init_fact(2000010);
    return kaijo[a]*modpow(kaijo[a-b],mod-2)%mod*modpow(kaijo[b],mod-2)%mod;
}
int inv(int x){
    x=modpow(x,mod-2);
    return x;
}
bool kosa(double ax,double ay,double bx,double by,double cx,double cy,double dx,double dy){
    double ta=(cx-dx)*(ay-cy)+(cy-dy)*(cx-ax);
    double tb=(cx-dx)*(by-cy)+(cy-dy)*(cx-bx);
    double tc=(ax-bx)*(cy-ay)+(ay-by)*(ax-cx);
    double td=(ax-bx)*(dy-ay)+(ay-by)*(ax-dx);
    return tc*td<0&&ta*tb<0;
}
int n,m,h[100010];
bool good[100010];
signed main(){
    cin>>n>>m;
    rep(i,n)cin>>h[i];
    rep(i,n)good[i]=true;
    rep(i,m){
        int a,b;
        cin>>a>>b;
        a--,b--;
        if(h[a]<=h[b])good[a]=false;
        if(h[b]<=h[a])good[b]=false;
    }
    int ans=0;
    rep(i,n)if(good[i])ans++;
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 4472
// abc061_a
#include <bits/stdc++.h>
#ifdef LOCAL
#include "../cxx-prettyprint/prettyprint.hpp"
#endif
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;

#define REP(i, n) for (int (i) = 0 ; (i) < (int)(n) ; ++(i))
#define REPN(i, m, n) for (int (i) = m ; (i) < (int)(n) ; ++(i))
#define REP_REV(i, n) for (int (i) = (int)(n) - 1 ; (i) >= 0 ; --(i))
#define REPN_REV(i, m, n) for (int (i) = (int)(n) - 1 ; (i) >= m ; --(i))
#define ALL(x) x.begin(), x.end()

#define INF ((1 << 29)-1)
#define MOD (1000000007)

#define print2D(h, w, arr) REP(i, h) { REP(j, w) cout << arr[i][j] << " "; cout << endl; }
#define print_line(vec, n) {for(int i=0;i<(n-1);i++) cout << (vec)[i] << " "; cout << (vec)[(n)-1] << endl;}
template<class T> void print(const T& x){cout << x << endl;}
template<class T, class... A> void print(const T& first, const A&... rest) { cout << first << " "; print(rest...); }
struct PreMain {PreMain(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(20);}} premain;

int main() {
#ifdef LOCAL
    ifstream in("../arg.txt"); cin.rdbuf(in.rdbuf());
#endif

    int A, B, C;
    cin >> A >> B >> C;

    if (C >= A && C <= B){
        print("Yes");
    } else {
        print("No");
    }

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{
    string str;
    cin >> str;
    for(int i = 0; i < str.length(); i++){
        if((i % 2 == 0 && str[i] == 'L')
                || (i % 2 == 1 && str[i] == 'R')){
            cout << "No";
            return 0;
        }
    }
    cout << "Yes";

}


Measured memory_bytes: 256
while True:
    m,f,r=map(int,input().split())
    if m==-1 and f==-1 and r==-1:
        break
    elif m==-1 or f==-1:
        grade="F"
    elif m+f>=80:
        grade="A"
    elif m+f<80 and m+f>=65:
        grade="B"
    elif m+f<65 and m+f>=50:
        grade="C"
    elif m+f<50 and m+f>=30:
        if r>=50:
            grade="C"
        else:
            grade="D"
    elif m+f<30:
        grade="F"
    print(grade)

Measured memory_bytes: 5592
#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 n;
  cin >> n;
  
  for(int i = 1; i < n+1; i++){
    int count = 0;
    for(int x = 1; x < 101; x++){
      for(int y = 1; y < x+1; y++){
        for(int z = 1; z < y+1; z++){
          if(x*x + y*y + z*z + x*y + y*z + z*x > i) break;
          if(x*x + y*y + z*z + x*y + y*z + z*x == i){
           if(x == y && y == z && z == x) count++;
           else if(x != y && y != z && z != x) count += 6;
           else count += 3;
          }
        }
      }
    }
    cout << count << endl;
  }
  return 0;
}

Measured memory_bytes: 3516
#include <cstdio>
#include <cstdint>
#include <cassert>
#include <vector>
#include <algorithm>
#include <utility>
#include <numeric>
#include <map>
#include <tuple>

int main() {
  intmax_t n, x, d;
  scanf("%jd %jd %jd", &n, &x, &d);

  if (d == 0)
    return !printf("%jd\n", (x == 0)? 1: n+1);

  if (d < 0) {
    d = -d;
    x = -x;
  }
  std::map<intmax_t, std::vector<std::pair<intmax_t, intmax_t>>> ii;
  for (intmax_t k = 0; k <= n; ++k) {
    intmax_t kx = k * x;
    intmax_t ind = kx % d;
    intmax_t ofs = kx / d;
    if (ind < 0) {
      --ofs;
      ind += d;
    }
    intmax_t is = k*(k-1) / 2;
    intmax_t ie = k*n - (k*(k+1))/2 + 1;
    ii[ind].emplace_back(ofs+is, ofs+ie);
  }

  intmax_t res = 0;
  for (auto& p: ii) {
    auto& v = p.second;
    std::sort(v.begin(), v.end());
    intmax_t s = v[0].first;
    intmax_t e = v[0].second;
    for (auto const& se0: v) {
      intmax_t s0, e0;
      std::tie(s0, e0) = se0;
      if (e0 < e) continue;
      if (s0 < e) {
        e = e0;
      } else {
        res += e - s;
        s = s0;
        e = e0;
      }
    }
    res += e - s;
  }

  printf("%jd\n", res);
}


Measured memory_bytes: 22144
#include <stdio.h>
#define N 10000


int main()
{
  int n,i,r,k,p;
  char a[N][2],b[N][2],tmp[2];
  scanf("%d",&n);

  for(i=0; i<n; i++) {
    scanf("%s",a[i]);
    for(k=0; k<2; k++) b[i][k]=a[i][k];
  }


  for(i=0; i<n; i++) {
    for(r=n-1; r>i; r--) {
      if(a[r][1]<a[r-1][1]) {
	     for(k=0; k<2; k++) {tmp[k]=a[r][k];}

	     for(k=0; k<2; k++) {a[r][k]=a[r-1][k];}

	     for(k=0; k<2; k++) {a[r-1][k]=tmp[k];}
      }
    }
  }


  for(i=0; i<n; i++) {
    p=i;
    for(r=i+1; r<n; r++) {
      if(b[r][1]<b[p][1]) {
         p=r;
      }
    }
    if(b[p][1]<b[i][1]) {
      for(k=0; k<2; k++) tmp[k]=b[i][k];

      for(k=0; k<2; k++) b[i][k]=b[p][k];

      for(k=0; k<2; k++) b[p][k]=tmp[k];
    }
  }


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

  for(i=0; i<n; i++) {
    if(i) printf(" ");
    printf("%c%c",a[i][0],a[i][1]);
  }


  printf("\nStable\n");
  for(i=0; i<n; i++)
   {
    if(i) printf(" ");
    printf("%c%c",b[i][0],b[i][1]);
   }

  if(z!=0) printf("\nStable\n");
  else printf("\nNot stable\n");
  return 0;
}



Measured memory_bytes: 2092
#include <bits/stdc++.h>
#include <sstream>
#include <iomanip>
#define ll long long
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define min_3(a,b,c) min(a,min(b,c))
#define max_3(a,b,c) max(a,max(b,c))
#define nout(ans) cout << (ans) << "\n"
#define sout(ans) cout << (ans) << " "
using namespace std;

const double pi = 3.14159265359;
const ll INF = 1e12;
const ll MOD = 1e9 + 7;
const ll N = 1e5 + 5;
/*
Decimal Places: cout << fixed << setprecision(n) << ans << endl

String to integer:
stringstream dark(s);
int x = 0; dark >> x;
*/

bool compare(const pair<int, int>&i, const pair<int, int>&j)
{
    return i.second < j.second;
}


int n, d[50], ans=0;

void solve()
{
    cin >> n;
    for (int i=0; i<n; i++) cin >> d[i];
    for (int i=0; i<n; i++) {
        for (int j=i+1; j<n; j++) ans+=d[i]*d[j];
    }nout(ans);
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    int t = 1;
    //cin >> t;
    for (int i=1; i<=t; i++)
    {
        solve();
    }
    return 0;
}


Measured memory_bytes: 3624
d=gets.to_i
c=gets.split.map(&:to_i)
s=[]
d.times do
  s << gets.split.map(&:to_i)
end
l=[0]*26
(d-2).times do |i|
  m=0
  mi=0
  26.times do |j|
    l[j]+=1
  end
  26.times do |j|
    cs1=c[j]*(3*l[j]-2)+s[i][j]
    26.times do |k|
      cs2=c[k]*(2*l[k]-1)+s[i+1][k]
      26.times do |kk|
        cs3=c[kk]*l[kk]+s[i+2][k]
        if cs1+cs2+cs3>m
          m=cs1+cs2+cs3
          mi=j
        end
      end
    end
  end
  puts mi+1
  l[mi]=0
end
m=0
mi=0
26.times do |j|
  l[j]+=1
end
26.times do |j|
  cs1=c[j]*(2*l[j]-1)+s[d-2][j]
  26.times do |k|
    cs2=c[k]*l[k]+s[d-1][k]
    if cs1+cs2>m
      m=cs1+cs2
      mi=j
    end
  end
end
puts mi+1
l[mi]=0
m=0
mi=0
26.times do |j|
  l[j]+=1
end
26.times do |j|
  cs=c[j]*l[j]+s[d-1][j]
  if cs>m
    m=cs
    mi=j
  end
end
puts mi+1


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

int main(){
  int N,ct=0,i,j;
  int cta=0,ctb=0,ctba = 0,l,f;
  char s[11];
  scanf("%d",&N);
  for(i = 0;i <N;i++){
    scanf("%s",s);
    l = strlen(s);
    f = 0;
    for(j = 0;j < l;j++){
      if(f == 1&&s[j]=='B'){ct++;}f = 0;
      if(s[j] == 'A'){f = 1;}
    }if(s[0] == 'B'){ctb++;}if(s[l-1] == 'A'){cta++;}
    if(s[0] == 'B'&&s[l-1]=='A'){ctba++;}
  }
  ct += (cta > ctb ? ctb:cta);
  if(ctba == ctb&&ctba == cta&&cta != 0){ct--;}
  printf("%d\n",ct);
  return 0;
}

Measured memory_bytes: 128
fun main(args: Array<String>) {
    val (N, K, Q) = listOfInt()
    val A = Array<Int>(Q) { nextInt(-1) }
    val W = Array<Int>(N) { Q }
    A.forEach { W[it] -= 1 }
    W.forEach { println(if (K - it > 0) "Yes" else "No") }
}
fun next() = readLine()!!
fun nextInt(delta: Int = 0) = Integer.parseInt(next()) + delta
fun listOfString() = next().split(" ")
fun listOfInt(delta: Int = 0) = listOfString().map { Integer.parseInt(it) + delta }

Measured memory_bytes: 48236
#include <bits/stdc++.h>
using namespace std;
int main(){
	long long n,k;
	cin>>n>>k;
	vector<long long> v(n);
	for(int i=0;i<n;i++){
		cin>>v[i];
	}
	partial_sum(v.begin(),v.end(),v.begin());
	vector<long long> a;
	for(int i=0;i<n;i++){
		for(int j=i;j<n;j++){
			a.push_back(v[j]-(i==0?0:v[i-1]));
		}
	}
	long long ans=0;
	for(int i=60;i>=0;i--){
		ans|=(1LL<<i);
		int cnt=0;
		for(int j=0;j<a.size();j++){
			if((a[j]&ans)==ans){
				cnt++;
			}
		}
		if(cnt<k){
			ans^=(1LL<<i);
		}
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 6132