akhauriyash/Code-Regression huggingface dataset:
//#include "bits/stdc++.h"

#define _USE_MATH_DEFINES
#include<cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <deque>
#include <algorithm>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <iterator>
#include<iomanip>
#include<unordered_set>
#include<unordered_map>
#include<bitset>
#include<complex>

using namespace std;

#define rep(i,a,b) for(int i=(a), i##_len=(b);i<i##_len;i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)

#define int ll
#define SZ(x) ((int)(x).size())
#define pb push_back
#define mp make_pair

//typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ll, int> pli;
typedef pair<double, double> pdd;
typedef vector< vector<int> > mat;

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

const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD =  (int)1e9 + 7;
const double EPS = 1e-9;

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

	int A,B,C,D;
	cin>>A>>B>>C>>D;
	if(B+1==D)cout<<0<<endl;
	else cout<<1<<endl;

	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define mod 10007
using namespace std;
typedef long long int ll;
typedef pair<int,int> pi;
ll gcd(ll a,ll b) {
    if (b==0) return a;
    return gcd(b,a%b);
}
ll lcm(ll a,ll b) {
    return (a*b)/gcd(a,b);
}
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

    int n,m;
    cin>>n>>m;
    string s,t;
    cin>>s;
    cin>>t;
    if (s[0]!=t[0]) {
        cout<<-1;
    }
    else {
        ll lo=1,hi=mod,mi;
        ll l=lcm(n,m);
        while (lo<hi) {
            mi = (lo+hi)/2;
            ll ln = mi*l;
            ll fn = lcm(ln/n,ln/m);
            int x = (int)(fn/(ln/n));
            int y = (int)(fn/(ln/m));
            bool ch = true;
            int i=x,j=y;
            while (i<n && j<m) {
                if (s[i]!=t[j]) {
                    ch = false;
                    break;
                }
                i+=x,j+=y;
            }
            if (ch) hi = mi;
            else lo = mi+1;
        }
        mi = lo;
        ll ln = mi*l;
        ll fn = lcm(ln/n,ln/m);
        int x = (int)(fn/(ln/n));
        int y = (int)(fn/(ln/m));
        bool ch = true;
        int i=x,j=y;
        while (i<n && j<m) {
            if (s[i]!=t[j]) {
                ch = false;
                break;
            }
            i+=x,j+=y;
        }
        if (ch) cout<<(lo*l);
        else cout<<-1;
    }
}


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

int main() {
  int A, B, C, D;
  cin >> A >> B >> C >> D;
  if((A+B)>(C+D)) {
    cout << "Left" << endl;
  }
  else if((A+B)==(C+D)) {
    cout << "Balanced" << endl;
  }
  else cout << "Right" << endl;
}

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

void main_()
{
    int H, W;
    cin >> H >> W;
    vector<string> pic;

    copy_n(istream_iterator<string>(cin), H, back_inserter(pic));
    cout << string(W + 2, '#') << "\n";
    for (auto&& p : pic) {
        cout << "#" << p << "#\n";
    }
    cout << string(W + 2, '#') << "\n";
}
int main()
{
    cin.tie(nullptr);
    cout.tie(nullptr);
    ios_base::sync_with_stdio(false);
    main_();
    return 0;
}


Measured memory_bytes: 256
a = []
n = int(raw_input())
for _ in range(n):
    a.append(map(int, raw_input().split()))
for i in range(n):
    f = [1,1,1]
    for j in range(n):
        if i == j:
            continue
        for k in range(3):
            if a[i][k] == a[j][k]:
                f[k] = 0
    print a[i][0]*f[0] + a[i][1]*f[1] + a[i][2]*f[2]

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

//素数判定
bool prime(int n){
  int n_root = sqrt(n);
  if(n==1){
    return false;
  }
  else if(n==2){
    return true;
  }
  else if (n%2==0){
    return false;
  }
  for(int i=3;i<n_root+1;i+=2){
    if(n%i==0){
      return false;
    }
  }
  return true;
}

int main() {
    int q;
    cin >> q;
    vector<int> odd(100010);
    //2017に似た数か否か判定
    for(int i=1;i<pow(10,5)+1;i+=2){
        if(prime(i)==true && prime(((i+1)/2))==true){
            odd[i] = 1;
        }
        else odd[i] = 0;
    }
    //累積和
    vector<int> sum(100010,0);//0番目を初期化
    for(int i=0;i<odd.size();i++){
        sum[i+1] = sum[i] + odd[i];
    }

    for(int i=0;i<q;i++){
        int l,r;
        cin >> l >> r;
        cout << sum[r+1] - sum[l] << endl;
    }
}



Measured memory_bytes: 1408
import java.util.*;

public class Main {
    static Scanner input = new Scanner(System.in);

    static public void solve() {
        int a = input.nextInt();
        int b = input.nextInt();
        int c = input.nextInt();
        input.close();

        int max = a;
        String ans = "A";
        if (b > max) {
            max = b;
            ans = "B";
        }
        if (c > max) {
            max = c;
            ans = "C";
        }
        System.out.println(ans);
    }

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


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

using namespace std;

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

    string s;
    cin >> s;
    int rock = 0, paper = 0;
    int ans = 0;
    for (int i = 0; i < s.length(); i++) {
        if (s[i] == 'g') {
            if (paper < rock) {
                paper++;
                ans++;
            }
            else rock++;
        }
        else {
            if (paper < rock) paper++;
            else {
                rock++;
                ans--;
            }
        }
    }

    cout << ans;
    return 0;
}


Measured memory_bytes: 512
#include <iostream>
#include <string>
#include <vector>
using namespace std;

int main() {
    vector<vector<char>> v = { {'.', ',', '!', '?', ' '},
                               {'a', 'b', 'c'},
                               {'d', 'e', 'f'},
                               {'g', 'h', 'i'},
                               {'j', 'k', 'l'},
                               {'m', 'n', 'o'},
                               {'p', 'q', 'r', 's'},
                               {'t', 'u', 'v'},
                               {'w', 'x', 'y', 'z'}};
    int n;
    cin >> n;
    for(int i=0; i<n; ++i) {
        string str;
        cin >> str;
        int counter = -1;
        int id = -1;
        for(int j=0; j<str.size(); ++j) {
            char c = str[j];
            if(c == '0' && id != -1) {
                cout << v[id][counter];
                id = -1;
                counter = -1;
            } else if(c != '0') {
                id = static_cast<int>(c - '0' - 1);
                counter = (counter+1)%v[id].size();
            }
        }
        cout << endl;
    }
}


Measured memory_bytes: 3024
import java.lang.*;
import java.io.*;
import java.util.*;

public class Main {
  public static void main(String arg[]) throws IOException { new Main().bw.close(); }

  BufferedReader br= new BufferedReader(new InputStreamReader(System.in));
  BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));

  StringTokenizer st = null;
  String nxttok() { 
    try { while (st == null || !st.hasMoreTokens()) st = new StringTokenizer(br.readLine()); }
    catch(Exception e) { return "";}
    return st.nextToken();
  }

  int nxtint() { return  Integer.parseInt(nxttok()); }
  long nxtlong() { return Long.parseLong(nxttok()); }

  int maxn = 333;
  int n;
  int[][] gr = new int[maxn][maxn];

  class Edge {
    int u;
    int v;
    int c;
    Edge(int u, int v, int c) {
      this.u = u; this.v = v; this.c = c;
    }
  }

  ArrayList<Edge> el;

  Main() throws IOException {
    n = nxtint();
    for (int i =-1; ++ i < n; )
      for (int f = -1; ++f < n; )
        gr[i][f] = nxtint();
    el = new ArrayList<Edge>();
    for (int i = -1; ++ i < n; )
      for (int f = i; ++f < n; )
        el.add(new Edge(i, f, gr[i][f]));
    el.sort((u, v) -> u.c - v.c);
    long ans = 0;
    for (Edge e: el) {
      int u = e.u, v = e.v, c = e.c;
      boolean founde = false;
      for (int i = -1; ++i < n; ) {
        if (i == u || i == v) continue;
        if (gr[u][i] > c || gr[v][i] > c) continue;
        if (gr[u][i] + gr[v][i] < c) {
          bw.write("-1");
          return;
        }
        if (gr[u][i] + gr[v][i] == c) founde = true;
      }
      if (!founde) ans += c;
    }
    bw.write(ans + "\n");
  }
}


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

int A,B;

void solve()
{
	vector<int> an(A), br(B);
	int ans = 0;
	for(int i = 0; i < A; i++)
		cin >> an[i];
	for(int j = 0; j < B; j++)
		cin >> br[j];

	for(int b = 0; b < br.size(); b++){
		int c = 0;

		for(int a = 0; a < an.size(); a++){
			if(br[b+c] == an[a]){
				c++;

				if(b + c >= br.size())
					break;
			}
		}
		ans = max(ans, c);
	}
	cout << ans << endl;
}


int main(void)
{
	cin >> A >> B;
	solve();
	return 0;
}

Measured memory_bytes: 1236
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#include <numeric>
typedef long long Int;
#define rep(i,a,b) for(Int i=a;i<b;++i)
#define rrep(i,a,b) for(Int i=a;i>=b;--i)
using namespace std;

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

    int X, Y, Z; cin >> X >> Y >> Z;
    cout << (X-Z)/(Y+Z) << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <sstream>
#include <iomanip> 
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <queue>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include <functional>
#include <algorithm>
#include <unordered_map>
#include <unordered_set>
#include <bitset>

using namespace std;


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

	int n, i, j, k, s;
	cin >> n;
	vector<int> c(n), v(n);
	for (i = 0; i < n; i++) cin >> v[i];
	for (i = 0; i < n; i++) cin >> c[i];
	s = 0;
	for (i = 0; i < n; i++) {
		if (v[i] > c[i]) s += v[i] - c[i];
	}
	cout << s << "\n";

	return 0;
}



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

#include <algorithm>
#include <cassert>
#include <cfloat>
#include <complex>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <regex>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>

using namespace std;

#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define repLRE(i, l, r) for (ll i = (l); i <= (r); ++i)
#define rrepLRE(i, l, r) for (ll i = (l); i >= (r); --i)
#define Sort(v) sort(v.begin(), v.end())
#define rSort(v) sort(v.rbegin(), v.rend())
#define Reverse(v) reverse(v.begin(), v.end())
#define Lower_bound(v, x) \
  distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x) \
  distance(v.begin(), upper_bound(v.begin(), v.end(), x))

using ll = long long;
using ull = unsigned long long;
using P = pair<ll, ll>;
using T = tuple<ll, ll, ll>;
using vll = vector<ll>;
using vP = vector<P>;
using vT = vector<T>;
using vvll = vector<vector<ll>>;
using vvP = vector<vector<P>>;
using dqll = deque<ll>;

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

/* Macros reg. ends here */

const ll INF = 1LL << 50;

int main() {
  // ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cout << fixed << setprecision(15);

  ll n;
  cin >> n;

  vll as(n), bs(n), cs(n);
  rep(i,n) cin >> as[i];
  rep(i,n) cin >> bs[i];
  rep(i,n) cin >> cs[i];

  Sort(as), Sort(bs), Sort(cs);

  vll bsum(n+1, 0);
  rep(i, n) {
    ll idx = Upper_bound(cs, bs[i]);
    bsum[i+1] = n - idx;
  }
  
  rep(i,n) bsum[i+1] += bsum[i];

  ll ans = 0;
  rep(i, n) {
    ll idx = Upper_bound(bs, as[i]);
    ans += bsum[n] - bsum[idx];
  }
  
  cout << ans << endl;

  return 0;
}


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

const char NL = '\n';
const char SP = ' ';
#define loop(i, a, b) for (int i = a; i < b; i++)

int main () {
  ios_base::sync_with_stdio(false);
  string s;
  cin >> s;
  if (s[s.size() - 1] == 's') {
    cout << s << "es\n";
  }
  else {
    cout << s << "s\n";
  }
  return 0;
}

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

#define ll long long
#define ld long double
#define db double
#define pb push_back
#define nl '\n'
#define X first
#define Y second
#define nimble ios::sync_with_stdio(0);cin.tie(0);
#define all(v) (v).begin(),(v).end()
#define mod(x,m) ((((x)%(m))+(m))%(m))
#define _sz(x) (int)x.size()
#define rep(i,a,b) for(int i=a;i<b;i++)
#define repv(v) for(int i=0;i<_sz(v);i++)
#define rep1(i,b,a) for(int i=b;i>=a;i--)
#define preci(x) fixed<<setprecision(x)
#define tc int tt=1;cin>>tt;rep(tcs,1,tt+1)

#define TRACE
#ifdef TRACE
#define see(...) __f(#__VA_ARGS__,__VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
	cerr<<name<<" : "<<arg1<<nl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma=strchr(names+1,',');cerr.write(names,comma-names)<<" : "<<arg1<<" | ";__f(comma+1, args...);
}
#else
#endif

int inf=0x3f3f3f3f;
ll infl=0x3f3f3f3f3f3f3f3fLL;
ld infd=1.0/0.0;
const ll MOD=1e9+7;// 998244353 // = (119<<23)+1
const ld pi=2*acos(0.0);

const int N=2e5+7;
int dsu[N];
int sizeofcom[N];

int Find(int n){
    return (n==dsu[n])?n:dsu[n]=Find(dsu[n]);
}

void Merge(int x,int y){
    x=Find(x);
    y=Find(y);
    dsu[y]=x;
}

int main(){
    nimble
    int n,m;
    cin>>n>>m;
    rep(i,1,n+1)
        dsu[i]=i;
    rep(i,0,m){
        int u,v;
        cin>>u>>v;
        Merge(u,v);
    }
    rep(i,1,n+1)
       Find(i);
    int ans=0;
    rep(i,1,n+1)
        ans=max(ans,++sizeofcom[dsu[i]]);
    cout<<ans<<nl;
    return 0;
}


Measured memory_bytes: 5132
import java.util.*;

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

		double r = sc.nextDouble();
		
		double area = r * r * Math.PI;
		double circle = (r + r) * Math.PI;
		
		System.out.printf("%.8f %.8f", area, circle);
	}
}

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


int main()
{
    int x, n;
    cin >> x >> n;
    vector<int> p(102);
    rep(i, n) {
        int id ;
        cin >> id;
        p[id] = 1;
    }
    P ans(102,-1);
    rep(i, 102){
        if (p[i] == 1) continue;
        int sub = abs(i-x);
        ans = min(ans, P(sub,i));
    }   
    cout << ans.second << endl;
}

Measured memory_bytes: 3596
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef pair<ll,ll> l_l;
const int INF=1001001000;
const int mINF=-1001001000;
const ll LINF=1010010010010010000;
template<class T> inline bool chmin(T& a, T b) {
if (a > b) {
a = b;
return true;
}
return false;
}
template<class T> inline bool chmax(T& a, T b) {
if (a < b) {
a = b;
return true;
}
return false;
}
int main(){
    int n,c;cin >> n >> c;
    vector<P> C[32];
    for(int i=0;i<n;i++){
        int s,t,cc;cin >> s >> t >> cc;
        cc--;
        C[cc].push_back({s,t});
    }
    vector<int> sum(100050);
    for(int i=0;i<c;i++){
        sort(C[i].begin(),C[i].end());
    }
    for(int i=0;i<c;i++){
        int f=-1;
        int nn=C[i].size();
        for(int j=0;j<nn;j++){
            if(f==-1) f=C[i][j].first;
            if(j+1==nn||C[i][j].second<C[i][j+1].first){
                sum[C[i][j].second+1]--;
                sum[f]++;
                f=-1;
            }
        }
    }
    for(int i=1;i<100050;i++) sum[i]+=sum[i-1];
    int ans=0;
    for(int i=0;i<100050;i++) chmax(ans,sum[i]);
    cout << ans << endl;
    return 0;
}

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

#define endl     '\n'

using namespace std;

typedef long long ll;

const int dx[] = { 1, -1, 0, 0, 1, 1, -1, -1 };
const int dy[] = { 0, 0, 1, -1, 1, -1, 1, -1 };
const char dir[] = {'D', 'U', 'R', 'L'};

void Fast() { cin.sync_with_stdio(0); cin.tie(0); cout.tie(0); }
void File()
{
    #ifndef ONLINE_JUDGE
    freopen("input.in", "r", stdin);
    //freopen("output.out", "w", stdout);
    #endif
}

const int N = 1e3 + 9, M = 1e3 + 9, oo = 0x3f3f3f3f;

/**----------------->>  Quality Over Quantity  <<----------------**/

int n, m, dis[N][N];
char grid[N][M];
queue <array <int, 2>> Q;

bool valid(int r, int c)
{
    return r >= 0 && r < n && c >= 0 && c < m && dis[r][c] == oo;//grid[r][c] == '.';
}

void BFS()
{
    array <int, 2> cell;
    int r, c;
    while(Q.size())
    {
        cell = Q.front(); Q.pop();
        for(int i = 0; i < 4; ++i)
        {
            r = cell[0] + dx[i];
            c = cell[1] + dy[i];
            if(!valid(r, c)) continue;
            dis[r][c] = dis[cell[0]][cell[1]] + 1;
            Q.push({r, c});
        }
    }
}

void Solve()
{
    cin >> n >> m;
    memset(dis, 0x3f, sizeof dis);

    for(int i = 0; i < n; ++i)
    for(int j = 0; j < m; ++j)
    {
        cin >> grid[i][j];
        if(grid[i][j] == '#')
            Q.push({i, j}), dis[i][j] = 0;
    }

    BFS();

    int ans = 0;
    for(int i = 0; i < n; ++i)
    for(int j = 0; j < m; ++j)
        if(dis[i][j] > ans) ans = dis[i][j];

    cout << ans << endl;
}

void MultiTest(bool Tests = 0)
{
    int tc = 1; (Tests) && (cin >> tc);
    for(int i = 1;  i <= tc; ++i)
        Solve();
}

/**------------------------->>  Main  <<-------------------------**/

int main()
{
    Fast();  MultiTest();
}


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

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

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

// 4近傍、8近傍
int dx[] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[] = {0, 1, 0, -1, 1, 1, -1, -1};

int main() {
  // 入力
  int r;
  cin >> r;

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

  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
int main(){
	char a[110],b[110],t,c[110];
	int i,j;
	int lena,lenb,flag1=0,flag2=0;
	while(scanf("%s %s",a,b)==2){
		flag1=0;
		flag2=0;
		lena=strlen(a);
		lenb=strlen(b);
		memset(c,'\0',sizeof(c));
		for(i=0;i<lena;i++){
			c[0]=a[lena-1];
			for(j=1;j<lena;j++){
				c[j]=a[j-1];
			}
			c[lena]='\0';
			strcpy(a,c);
			if(strcmp(c,b)==0){
				flag1=1;
			}
		}
		memset(c,'\0',sizeof(c));
		for(i=0;i<lenb;i++){
			c[0]=b[lenb-1];
			for(j=1;j<lenb;j++){
				c[j]=b[j-1];
			}
			c[lenb]='\0';
			strcpy(b,c);
			if(strcmp(c,a)==0){
				flag2=1;
			}
		}
		if(flag1==1&&flag2==1){
			printf("Yes\n");
		}else{
			printf("No\n");
		}
	}
	return 0;
}

Measured memory_bytes: 128
#include<stdio.h>

int main()
{
    int n,i,temp;
    scanf("%d",&n);
    int a[n];
    for(i=0;i<n;i++)
    {
        scanf("%d",&a[i]);
    }
    for(i=0;i<n/2;i++)
    {
        temp=a[i];
        a[i]=a[n-i-1];
        a[n-i-1]=temp;
    }
    for(i=0;i<n;i++)
    {
        printf("%d",a[i]);
        if(i<n-1)
            printf(" ");
    }
    printf("\n");

    return 0;

}




Measured memory_bytes: 2104
#include <algorithm>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>
using namespace std;

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

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

// Self settings
// clang-format off
#define MAX_N 100000
#define REP(i, N) for (int i = 0; i < (int)(N); ++i)
#define SLN(i,N) (i == N-1 ? "\n" : " ")
ll fact(ll n) { ll res = 1; for(ll i=2;i<=n;++i) res = res * i; return res;}
ll nCr(ll n, ll r) {return (fact(n)/fact(n-r)*fact(r)) ;}
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;}
const ll MOD = 1e9+7;
const ll INF = 1LL << 60;
const int inf = 1 << 31;
// clang-format on

int N, A, B;

int digitSum(int n)
{
  int sum = 0;
  while (n > 0) {
    sum += (n % 10);
    n /= 10;
  }
  return sum;
}

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

  cin >> N >> A >> B;

  ll ans = 0;
  for (int i = 1; i <= N; i++) {
    int sum = digitSum(i);
    if (A <= sum && sum <= B) {
      ans += i;
    }
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;
typedef pair<ll,ll> pll;
const ll mod=1e9+7;
//const ll mod=998244353;
const ll inf=1LL<<61;

const ll N=1e5+10;
vector<map<ll,ll>> G(N);
vec al(N);
vec d(N);
ll n,m;

ll dfs(ll f) {
  ll res=1;
  ll fd=d[f];
  al[f]=1;
  for(auto p:G[f]) {
    ll td=fd+p.second;
    ll t=p.first;
    if(al[t]) {
      if(d[t]!=td)return 0;
    }
    else {
      d[t]=td;
      if(!dfs(t)) res=0;
    }
  }
  return res;
}

int main() {
  cin >> n >> m;
  for(ll i=0;i<m;i++) {
    ll l,r,d;
    cin >> l >> r >> d;
    G[l][r]=d;
    G[r][l]=-d;
  }
  ll f=1;
  for(ll i=1;i<=n;i++) {
    if(!al[i]&&!dfs(i)) f=0;
  }
  if(f) cout << "Yes" << endl;
  else cout << "No" << endl;
}

Measured memory_bytes: 34304
// C++(GCC 9.2.1)
#include <bits/stdc++.h>
using namespace std;
using LL = long long;
#define repex(i, a, b, c) for(int i = a; i < b; i += c)
#define repx(i, a, b) repex(i, a, b, 1)
#define rep(i, n) repx(i, 0, n)
#define repr(i, a, b) for(int i = a; i >= b; i--)
#define pb push_back
LL dp[3030][3030][4]; // 第一成分: 行, 第二成分: 列, 第三成分: 同じ行で, 拾ったアイテム個数.
LL board[3030][3030];

int main(){
    
    // 1. 入力情報.
    int R, C, K;
    scanf("%d %d %d", &R, &C, &K);
    rep(i, K){
        int r, c;
        LL v;
        scanf("%d %d %lld", &r, &c, &v);
        r--, c--;
        board[r][c] = v;
    }
    
    // 2. dp更新.
    rep(r, R + 1){
        rep(c, C + 1){
            // 次行に進む場合.
            if(r < R){
                LL rMax = 0;
                // 移動前の行で, アイテムが置いてあった場合を考慮.
                rep(k, 4) rMax = max(rMax, dp[r][c][k] + board[r][c] * (k < 3));
                rep(k, 4) dp[r + 1][c][k] = max(dp[r + 1][c][k], rMax);
            }
            
            // 次列に進む場合.
            if(c < C){
                rep(k, 4) dp[r][c + 1][k] = max(dp[r][c + 1][k], dp[r][c][k]);
                
                // アイテムが置いてあった場合.
                LL v = board[r][c];
                if(v) rep(k, 3) dp[r][c + 1][k + 1] = max(dp[r][c + 1][k + 1], dp[r][c][k] + v);
            }
        }
    }
    
    // 3. 出力.
    LL ans = 0;
    rep(k, 4) ans = max(ans, dp[R][C][k]);
    printf("%lld\n", ans);
    return 0;
    
}

Measured memory_bytes: 358868
n=int(input())
per=[i+1 for i in range(n)]
from itertools import permutations
per=list(permutations(per,n))

from bisect import bisect_left
p=tuple(map(int,input().split()))
q=tuple(map(int,input().split()))

print(abs(bisect_left(per,p)-bisect_left(per,q)))


Measured memory_bytes: 69908
#pragma GCC optimize("Ofast")
#include "bits/stdc++.h"

using namespace std;

typedef long int li;
typedef long double ld;
typedef long long ll;
typedef pair<int, int> pt;

#define fi first
#define se second
#define dump(x) cout << #x << " = " << x << endl
#define fastIO ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);

const ll M = (ll)1e9+7;

li h, w;
ll dp[1007][1007];
char c;

int main () {
    fastIO;
    cin >> h >> w;
    dp[0][0]=1;
    for(li i = 0; i < h; i ++) {
        for(li j = 0; j < w; j ++) {
            cin >> c;
            if (c=='#') dp[i][j]=0;
            else {
                if(i != 0 && j != 0 ) dp[i][j] = (dp[i-1][j]+dp[i][j-1])%M;
                else if(i == 0 && j != 0) dp[i][j] = dp[i][j-1];
                else if(i != 0 && j == 0) dp[i][j] = dp[i-1][j];
            }
        }
    }

    //for(li i = 0; i < w; i ++) { for(li j = 0; j < h; j ++) cout << dp[i][j] << " ";  cout << "\n";}

    cout << dp[h-1][w-1];
}


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

using namespace std;

int main()
{
    int k, a, b;
    long long int ans = 1;

    cin >> k >> a >> b;

    for (int i = 0; i < k; i++) {
        if (ans >= a && a < b-1 && i < k-1) {
            ans -= a;
            ans += b;
            i++;
        }
        else {
            ans++;
        }
    }

    cout << ans << endl;
}


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

int main(){
	int n,l;
	cin >> n >> l;
	int taste = n*l + n*(n-1)/2;
       	if (0 <= l) taste -= l;
	else if (l+n-1 <= 0) taste -= (l+n-1);
		
	cout << taste << endl;
	return 0;
}

Measured memory_bytes: 3616
#include <iostream>
#include <vector>
#include <bits/stdc++.h>
#define FOR(i, a, n) for(int i = (int)(a); i < (int)(n); ++i)
#define REP(i, n) FOR(i, 0, n)
using namespace std;
int main(){
    // Your code here

    string s;
    cin >> s;

    if(s[0]==s[2]){
        cout << "Yes" <<endl;
    }else{
        cout << "No" <<endl;
    }
}

Measured memory_bytes: 256
def solve():
 seq1 = raw_input()
 seq2 = raw_input()
 a, b = len(seq1), len(seq2)
 x1 = [0 for i in range(b+1)]
 for i in range(a):
  e1 = seq1[i]
  x2 = x1+[]
  for j in range(b):
   if e1 == seq2[j]:
    x1[j+1] = x2[j] + 1
   elif x1[j+1]<x1[j]:
    x1[j+1] = x1[j]
 return x1[-1]
n = input()
for i2 in range(n):
 print solve()

Measured memory_bytes: 6388
n = int(input())
Ss = []
for i in range(n):
    Ss.append(input())

import collections

Ss_counted = collections.Counter(Ss)
max_val = max(Ss_counted.values())

# # https://note.nkmk.me/python-dict-value-max-min/

result = []
for k, v in Ss_counted.items():
    if v == max_val:
        result.append(k)

result = sorted(result)
for i in range(len(result)):
    print(result[i])

Measured memory_bytes: 35476
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

	public static void main(String[] args) throws IOException {

		try(BufferedReader br = new BufferedReader(new InputStreamReader(System.in))){

			final String inputLine = br.readLine();
			final String[] inputNumbers = inputLine.split(" ");

			final Integer a = Integer.valueOf(inputNumbers[0]);
			final Integer b = Integer.valueOf(inputNumbers[1]);
			final Integer c = Integer.valueOf(inputNumbers[2]);

			Integer divisors = 0;
			for(Integer count = a; count <= b ; count++) {
				if(c % count == 0) {
					divisors++;
				}
			}

			System.out.println(divisors);
		}
	}

}


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

DA = {}
for a in A:
    if a in DA.keys():
        DA[a] += 1
    else:
        DA[a] = 1

ans = 0
c = 0
for k, v in DA.items():
    c += v
    if k+1 in DA:
        c += DA[k+1]
    if k-1 in DA:
        c += DA[k-1]
    ans = max(ans, c)
    c = 0
print(ans)

Measured memory_bytes: 14092
#include <iostream>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <limits>

#define rep(i, n) for (int i = 0; i < (n); i++)
#define all(x) (x).begin(), (x).end()
using namespace std;
using lint = long long;
using P = pair<int, int>;

// int F, H, I, J, K, L, M, N, S, T, U;
// lint F, H, I, J, K, L, M, N, S, T, U;
string A, B;
string ans = "", tmp = "";

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

	cin >> A >> B;

	rep(i, atoi(B.c_str())) {
		ans += A;
	}
	rep(i, atoi(A.c_str())) {
		tmp += B;
	}

	if (ans > tmp) {
		ans = tmp;
	}

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

Measured memory_bytes: 256
#include <cstdio>

using namespace std;

const int MAXN = 1000;
const int mod = 1000000007;

char s[MAXN + 5][MAXN + 5];
int dp[MAXN + 5][MAXN + 5];
int main() {
	int n, m;
	scanf("%d%d", &n, &m);
	for (int i = 1; i <= n; ++ i) {
		scanf("%s", s[i] + 1);
	}
	dp[0][1] = 1;
	for (int i = 1; i <= n; ++ i) {
		for (int j = 1; j <= m; ++ j) {
			if (s[i][j] ^ '#') {
				dp[i][j] = (dp[i - 1][j] + dp[i][j - 1]) % mod;
			}
		}
	}
	printf("%d\n", dp[n][m]);
	return 0;
} 

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

using namespace std;

int main() {
  ios::sync_with_stdio(false);

  int n_stamp;
  cin >> n_stamp;

  string s;
  cin >> s;

  int cnt = 0;
  for (int i = 0; i < n_stamp - 1; i++) {
    // cout << s[i] << endl;
    if (s[i] != s[i + 1]) {
      cnt++;
      i++;
    }
  }

  cout << cnt << endl;
}




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

#define step(i, s, n, d) for(int i=s; i<n; i+=d)
#define FOR(i,s,n) step(i,s,n,1)
#define rep(i,n) FOR(i,0,n)
#define gets(x) x; cin >> x;
#define puts(x) x; cout << x << endl;
#define list_input(x, n) x[n]; rep(i,n){ gets(x[i]);}
#define ll long long

int main(){
	ll INF = 1ll << 50;
	int N, M;
	cin >> N >> M;
	int NMAX = 1000, MMAX = 2000;
	ll a[MMAX], b[MMAX], c[MMAX];
	rep(i, M){
		cin >> a[i] >> b[i] >> c[i];
		c[i] = -c[i];
	}

	ll dist[NMAX] = {INF};

	rep(i, N){
		dist[i] = INF; //大きな数で初期化
	}

	dist[0] = 0;

	rep(j, N-1){
		rep(i, M){
			if (dist[a[i]-1] == INF){
				continue;
			}

			if (dist[b[i]-1] > dist[a[i]-1] + c[i]){
				dist[b[i]-1] = dist[a[i]-1] + c[i];
			}
		}
	}

	ll result = dist[N-1];
	bool negative[NMAX];

	rep(i, N){
		negative[i] = false;
	}

	rep(j, N-1){
		rep(i, M){
			if (dist[a[i]-1] == INF){
				continue;
			}

			if (dist[b[i]-1] > dist[a[i]-1] + c[i]){
				dist[b[i]-1] = dist[a[i]-1] + c[i];
				negative[b[i]-1] = true;
			}

			if (negative[a[i]-1] == true){
				negative[b[i]-1] = true;
			}
		}
	}
	if (negative[N-1]){
		puts("inf")
	}else{
		puts(-result)
	}
}



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

using namespace std;

const int MAXN = 100;
int freq[MAXN];

int main()
{
    int n,m;
    cin >> n >> m;
    for(int i = 0 ; i < n ; i++) 
    {
        int x;
        cin >> x;
        for(int j = 0 ; j < x ; j++)
        {
            int a;
            cin >> a;
            freq[a]++;
        }
    }
    
    int ans = 0;
    for(int i = 1 ; i <= 30 ; i++) ans += (freq[i] == n);
    cout << ans ;
    

}

Measured memory_bytes: 256
s=input()
n=len(s)
i,a,ans=0,0,0
while i<n:
    if s[i]=="A":
        a+=1
        i+=1
    elif i<n-1 and s[i:i+2]=="BC":
        ans+=a
        i+=2
        while i<n:
            if s[i]=="A":
                a+=1
                i+=1
            elif i<n-1 and s[i:i+2]=="BC":
                ans+=a
                i+=2
            else:
                a=0
                i+=1
                break
    else:
        i+=1
        a=0
print(ans)

Measured memory_bytes: 3500
import sys
from sys import exit
from collections import deque
from bisect import bisect_left, bisect_right, insort_left, insort_right
from heapq import heapify, heappop, heappush
from itertools import product, permutations, combinations, combinations_with_replacement
from functools import reduce
from math import gcd, sin, cos, tan, asin, acos, atan, degrees, radians

sys.setrecursionlimit(10**6)
INF = 10**20
eps = 1.0e-20
MOD = 10**9+7

def lcm(x,y):
    return x*y//gcd(x,y)
def lgcd(l):
    return reduce(gcd,l)
def llcm(l):
    return reduce(lcm,l)
def powmod(n,i,mod):
    return pow(n,mod-1+i,mod) if i<0 else pow(n,i,mod)
def div2(x):
    return x.bit_length()
def div10(x):
    return len(str(x))-(x==0)
def intput():
    return int(input())
def mint():
    return map(int,input().split())
def lint():
    return list(map(int,input().split()))
def ilint():
    return int(input()), list(map(int,input().split()))
def judge(x, l=['Yes', 'No']):
    print(l[0] if x else l[1])
def lprint(l, sep='\n'):
    for x in l:
        print(x, end=sep)
def ston(c, c0='a'):
    return ord(c)-ord(c0)
def ntos(x, c0='a'):
    return chr(x+ord(c0))
class counter(dict):
    def __init__(self, *args):
        super().__init__(args)
    def add(self,x,d=1):
        self.setdefault(x,0)
        self[x] += d
    def list(self):
        l = []
        for k in self:
            l.extend([k]*self[k])
        return l
class comb():
    def __init__(self, n, mod=None):
        self.l = [1]
        self.n = n
        self.mod = mod
    def get(self,k):
        l,n,mod = self.l, self.n, self.mod
        k = n-k if k>n//2 else k
        while len(l)<=k:
            i = len(l)
            l.append(l[i-1]*(n+1-i)//i if mod==None else (l[i-1]*(n+1-i)*powmod(i,-1,mod))%mod)
        return l[k]
def pf(x):
    C = counter()
    p = 2
    while x>1:
        k = 0
        while x%p==0:
            x //= p
            k += 1
        if k>0:
            C.add(p,k)
        p = p+2-(p==2) if p*p<x else x
    return C

H,W=mint()
s=[input() for _ in range(H)]
c=[[-1]*W for _ in range(H)]
c[0][0]=1
q=deque([(0,0)])
while q:
    x,y=q.popleft()
    for i,j in [(x-1,y),(x+1,y),(x,y-1),(x,y+1)]:
        if 0<=i<H and 0<=j<W and s[i][j]=='.' and c[i][j]<0:
            c[i][j] = c[x][y]+1
            q.append((i,j))
if c[H-1][W-1]<0:
    print(-1)
else:
    w=0
    for ss in s:
        w+=ss.count('.')
    print(w-c[H-1][W-1])

Measured memory_bytes: 74220
package main

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

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

func max(x, y int) int {
	if x > y {
		return x
	}
	return y
}

func min(x, y int) int {
	if x < y {
		return x
	}
	return y
}

func main() {
	input := bufio.NewReader(os.Stdin)

	var a, b int
	fmt.Fscanf(input, "%d %d\n", &a, &b)
	fmt.Println(max(max(a+b, a-b), a*b))
}


Measured memory_bytes: 640
#include<iostream>
#include<vector>
#include<algorithm>
#include<cctype>
#include<utility>
#include<string>
#include<cmath>

#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)
#define INF 999999999
using namespace std;
typedef pair<int, int> P;
typedef pair<llong, llong> LP;
typedef pair<int, P> PP;
typedef pair<llong, LP> LPP;

typedef long long int ll;

int main(){

    string s;
    ll k;
    cin >> s >> k;

    for(ll i = 0;i < k;i++){
        if(s[i] != '1'){
            cout << s[i] << endl;
            return 0;
        }
    }
    cout << '1' << endl;
    


    return 0;
}

Measured memory_bytes: 256
#include <vector>
#include <iostream>
using namespace std;
using ll = long long;
const ll mod = 998244353;

int N, S;
vector<int> A;

int main (void)
{
	cin >> N >> S;
	A.resize (N);
	for (auto& e: A)
		cin >> e;

	vector<vector<vector<ll>>> DynamicP (N+1);
	for (auto& e: DynamicP)
	{
		e.resize (S+1);
		for (auto& e2: e)
			e2.resize (3);

	}
	DynamicP[0][0][0] = 1;
	for (int i = 0; i < N; i++)
		for (int s = 0; s <= S; s++)
		{
			(DynamicP[i+1][s][0] += DynamicP[i][s][0]) %= mod;
			(DynamicP[i+1][s][1] += DynamicP[i][s][0] + DynamicP[i][s][1]) %= mod;
			(DynamicP[i+1][s][2] += DynamicP[i][s][0] + DynamicP[i][s][1] + DynamicP[i][s][2]) %= mod;
			if (s + A[i] <= S)
			{
				(DynamicP[i+1][s+A[i]][1] += DynamicP[i][s][0] + DynamicP[i][s][1]) %= mod;
				(DynamicP[i+1][s+A[i]][2] += DynamicP[i][s][0] + DynamicP[i][s][1]) %= mod;
			}
		}
	cout << DynamicP [N][S][2] << endl;
	return 0;
}


Measured memory_bytes: 492928
house = Array.new(4) do
  Array.new(3) do
    Array.new(10) { 0 }
  end
end
n = gets.to_i
n.times do
  b, f, r, v = gets.split.map(&:to_i)
  house[b - 1][f - 1][r - 1] += v
end

s = house.map do |f|
  line = f.map do |r|
    "\s" + r.join("\s")
  end
  line.join("\n")
end
puts s.join("\n" + ('#' * 20) + "\n")

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

#define ll long long
#define FOR(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define REP(i, x) for (int i = 0; i < (int)(x); i++)
#define REPS(i, x) for (int i = 1; i <= (int)(x); i++)
#define RREP(i, x) for (int i = ((int)(x)-1); i >= 0; i--)
#define RREPS(i, x) for (int i = ((int)(x)); i > 0; i--)
#define INF 2147483647
#define LLINF 9223372036854775807LL
#define vi vector<int>
#define vvi vector<vector<int>>
#define vvvi vector<vector<vector<int>>>
#define pi pair<int, int>
#define ALL(a) (a).begin(), (a).end()
#define BIT(n) (1LL << (n))

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

int main(){
int N,D; cin>>N>>D;
int X[N][D];
for(int i=0;i<N;i++){
    for(int j=0;j<D;j++){
    cin>>X[i][j];
    }
}
int ans=0;
for(int i=0;i<N-1;i++){
    for(int k=i+1;k<N;k++){
        double tmp=0;
        for(int j=0;j<D;j++){
        tmp+=(X[i][j]-X[k][j])*(X[i][j]-X[k][j]);
        }
    
         int tmp2=sqrt(tmp);
        if(tmp2*tmp2==tmp){
            ans++;
            }       

    
    }
}
cout<<ans<<endl;
}

Measured memory_bytes: 3648
#include <bits/stdc++.h>
#define REP(i,n) for(ll i = 0; i < (ll)n; i++)
#define FOR(i,a,b) for (ll i=(a);i<(ll)b; i++)
#define ALL(obj) (obj).begin(),(obj).end()
#define INF 1LL << 60
using namespace std;
typedef long long ll;
typedef double db;
typedef string str;
typedef pair<ll,ll> p;
const int MOD = 1000000007;

// vector<p> cut(M);
// cut[i].second
// cut[i].first;
// REP(i,M){
//     int a,b;cin>>a>>b;
//     cut[i] = make_pair(b,a);//last first の順番
// }
// for(int i=0; i<N;i++){
// }
// sort(cut.begin(),cut.end()); //sort
// char '' str ""
int main(void)
{
    ll N,h;cin>>N>>h;
    vector<ll> a; vector<ll> b; vector<p> v;
    ll sum=0;
    for(int i=0; i<N;i++){
      ll aa,bb; cin>>aa>>bb;
      a.push_back(aa); b.push_back(bb);
    }
    sort(a.begin(), a.end(), greater<ll>()); sort(b.begin(), b.end(), greater<ll>());
    for(int i=0; i<N;i++){
      sum += b[i]; v.push_back(make_pair(sum, i+1));
    }
    ll max_a = a[0]; ll ans=INF;
    for(int i=0; i<N;i++){
      ll tmp;
      if((h - v[i].first) <= 0) tmp = v[i].second;
      else tmp = (h - v[i].first-1)/max_a + 1 + v[i].second;
      ans = min(ans, tmp);
    }

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


Measured memory_bytes: 3948
N, K, Q = list(map(int, input().split()))

A = [0]*N

for i in range(Q):
  num = int(input())
  A[num-1] += 1

for l in range(N):
  if K - Q + A[l] > 0:
    print("Yes")
  else:
    print("No")

               

Measured memory_bytes: 4680
N = int(input())
ABs = [list(map(int, input().split())) for i in range(N)]
ABs.sort(key=lambda AB: AB[1])
t = 0
for i in range(N):
  AB = ABs[i]
  A = AB[0]
  B = AB[1]
  t = t + A
  if t > B:
    print("No")
    break
  if i == N-1:
    print("Yes")


Measured memory_bytes: 53600
#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <utility>
#include <tuple>
#include <string>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define SORT(x) sort(x.begin(),x.end())
#define REVE(x) reverse(x.begin(),x.end())
#define all(x) (x).begin(),(x).end()
#define fst first
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define pob pop_back
#define sw swap
using LL = long long;
using ULL = unsigned long long;
#define FOR(i, m, n) for(int i = m;i < n;i++)
template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n,a,b,c;
    cin >> a >> b;
    if(a+b>=24){
      cout << a + b - 24;
       }else{
         cout << a + b;
       }
  
}

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

int main(){
  string s;cin >> s;
  map<char,int> m;
  rep(i,3){
    m[s[i]] = 1;
  }
  if(m['a'] == 0)cout << "No";
  else if(m['b'] == 0)cout << "No";
  else if(m['c'] == 0)cout << "No";
  else cout << "Yes" << endl;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,l,r) for(long long i=(l);i<(r);++i)
#define REP(i,n) FOR(i,0,n)
#define REPS(i,n) FOR(i,1,n+1)
#define int long long
#define mp make_pair
#define pb push_back
#define eb emplace_back
const int MOD=1e9+7;
const int INF=1e18;

signed main(){
    int N;cin>>N;
    cout<<N*(N+1)/2<<endl;
}

Measured memory_bytes: 256
import java.util.Map;
import java.util.Scanner;
import java.util.TreeMap;

public class Main{
	static Map<Long,Long> map= new TreeMap<>();
  public static void main(String[] args){
	  Scanner sc = new Scanner(System.in);
	   int n=sc.nextInt();
	   long[] a=new long[n];
	   for(int i=0;i<n;i++)a[i]=sc.nextLong();
	   int count=0,buff=0;
	   for(int i=0;i<n;i++) {
		   if(a[i]%4==0)count++;
		   else if(a[i]%2==0)buff++;
	   }
	   buff=buff/2;
	   count+=buff;
	   if(count>=n/2) {
		   System.out.println("Yes");
	   }else {
		   System.out.println("No");
	   }
  }
	public static Map<Long,Long> primeEnum(long n) {
		for(long i=2;i<=Math.sqrt(n);i++) {
			if(n%i!=0)continue;
			long e=0;
			while(n%i==0) {
				e++;
				n/=i;
			}
			if(map.containsKey(i)) {
				map.put(i, e+map.get(i));
			}else {
				map.put(i, e);
			}
		}
		if(n!=1) {
			if(map.containsKey(n)) {
				map.put(n, 1+map.get(n));
			}else {
				map.put(n, 1L);
			}
		}
		return map;
	}
	public static long GCD(long min,long max) {
		if(max%min==0)return min;
		else return GCD(max%min,min);
	}

	public static boolean prime(long n) {
		if(n==1)return false;
		else if(n==2)return true;
		else if(n%2==0)return false;

		for(int i=2;i<=Math.sqrt(n);i++) {
			if(n%i==0)return false;
		}
		return true;
	}
}



Measured memory_bytes: 51552
/*input
8 6 1 1
AC
BC
AB
BC
AC
BC
AB
AB
*/

#include <bits/stdc++.h>
#define ll long long

using namespace std;

vector<int> ret, arr(3);

void update(int x, int y, int index) {
	ret[index] = x;
	arr[x]++;
	arr[y]--;
}

void run() {
	int n, i;
	cin >> n >> arr[0] >> arr[1] >> arr[2];
	vector<string> ops(n);
	ret.resize(n);
	for(auto &s : ops)
		cin >> s;
	for(i=0; i<n; i++) {
		int x = ops[i][0] - 'A', y = ops[i][1] - 'A';
		if(arr[x] <= 0  &&  arr[y] <= 0) {
			cout << "No\n";
			return;
		}
		if(arr[x] == 0)
			update(x, y, i);
		else if(arr[y] == 0)
			update(y, x, i);
		else if(arr[x] == 1  &&  arr[y] == 1) {
			if(i + 1 < n) {
				if(((ops[i + 1][0]-'A') == x)  ||  ((ops[i + 1][1]-'A') == x))
					update(x, y, i);
				else
					update(y, x, i);
			}
			else
				update(x, y, i);
		}
		else {
			if(arr[x] <= arr[y])
				update(x, y, i);
			else
				update(y, x, i);
		}
	}
	cout << "Yes\n";
	for(int x : ret)
		cout << (char) (x + 'A') << "\n";
}

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


Measured memory_bytes: 6636
Imports System
Module ABC106B
	Function Count(ByVal n As Integer) As Integer
		Dim cnt As Integer = 0
		For i As Integer = 1 To n
			If n Mod i = 0
				cnt += 1
			End IF
		Next
		Return cnt
	End Function

	Sub Main()
		Dim n As Integer = Integer.Parse(Console.ReadLine())
		Dim ans As Integer = 0
		
		For i As Integer = 1 To n
			If i Mod 2 = 0
				Continue For
			End If
			If Count(i) = 8
				ans += 1
			End If
		Next
		Console.WriteLine(ans)
	End Sub
End Module


Measured memory_bytes: 11092
use std::io;

fn main() {
    let n: u8 = read_a_line().parse().unwrap();
    println!("{}", (n as f32 / 2f32).ceil() / n as f32);
}

fn read_a_line() -> String {
    let mut input = String::new();
    io::stdin().read_line(&mut input).unwrap();
    input.trim().to_string()
}

Measured memory_bytes: 4352
import java.util.*;
public class Main{
 public static void main(String[] args){
   Scanner sc = new Scanner(System.in);
   int A = sc.nextInt();
   int B = sc.nextInt();
   
   if(B%A==0) System.out.println(A+B);
   else System.out.println(B-A);
 }
}

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


int main() {
  string flo;
  cin >> flo;
  int L = flo.size();
  vector<int> border(0);
  
  for (int i = 0; i < L-1; i++) {
    if (flo.at(i) != flo.at(i+1)) border.push_back(i);
  }
  border.push_back(L-1);

  int F = -1;
  int B = 0;
  int katamari = 0;
  int N = border.size() / 2;
  vector<int> ans(L);
  
  for (int i = 0; i < N; i++) {
    B = border.at(2*i + 1);
    katamari = B - F;
    F = border.at(2*i + 1);
    if (katamari % 2 == 0){
      ans.at(border.at(2*i)) = katamari / 2;
      ans.at(border.at(2*i) + 1) = katamari / 2;
      }
    if (katamari % 2 == 1){
      if ((border.at(2*i + 1) - border.at(2*i)) % 2 == 0){
        ans.at(border.at(2*i)) = katamari / 2 + 1;
        ans.at(border.at(2*i) + 1) = katamari / 2;
      }
      else{
        ans.at(border.at(2*i)) = katamari / 2;
        ans.at(border.at(2*i) + 1) = katamari / 2 + 1;
      }
      
    }  
  }
  for (int i = 0; i < L-1; i++) {
    cout << ans.at(i) << ' ';
  }
  cout << ans.at(L-1) << endl;
  
}


Measured memory_bytes: 1528
using System;
using System.Collections.Generic;
using System.Linq;

class Program {
    static int ReadInt() { return int.Parse(Console.ReadLine()); }
    static int[] ReadInts() { return Console.ReadLine().Split().Select(int.Parse).ToArray(); }
    static string[] ReadStrings() { return Console.ReadLine().Split(); }

    static int Sign(double x) {
        if (x > 0) return 1;
        if (x < 0) return -1;
        return 0;
    }

    static string Calc(Vec2f a, Vec2f b, Vec2f c) {
        var ab = b - a;
        var ac = c - a;

        var q = ab.Cross(ac);
        if (q > 0) return "COUNTER_CLOCKWISE";
        if (q < 0) return "CLOCKWISE";

        // when q = 0
        // c ??? a ????????? b ??¨?????????
        if ((a.X == c.X && a.Y == c.Y) || (b.X == c.X && b.Y == c.Y))
            return "ON_SEGMENT";

        // ????????????????????????
        if (Sign(ab.X) == Sign(ac.X) && Sign(ab.Y) == Sign(ac.Y)) {
            if (ab.SqrMagnitude() >= ac.SqrMagnitude())
                return "ON_SEGMENT";
            return "ONLINE_FRONT";
        }
        else {
            return "ONLINE_BACK";
        }
    }

    static void Main() {
        var xs = ReadInts();
        var p0 = new Vec2f(xs[0], xs[1]);
        var p1 = new Vec2f(xs[2], xs[3]);

        int q = ReadInt();
        for (int i = 0; i < q; i++) {
            var xy = ReadInts();
            var p2 = new Vec2f(xy[0], xy[1]);
            var ans = Calc(p0, p1, p2);
            Console.WriteLine(ans);
        }
    }
}

struct Vec2f {
    public double X { get; private set; }
    public double Y { get; private set; }

    public Vec2f(double x, double y) : this() {
        X = x;
        Y = y;
    }

    public override string ToString() {
        return string.Format("({0}, {1})", X, Y);
    }

    public static Vec2f operator+(Vec2f a, Vec2f b) {
        return new Vec2f(a.X + b.X, a.Y + b.Y);
    }

    public static Vec2f operator-(Vec2f a, Vec2f b) {
        return new Vec2f(a.X - b.X, a.Y - b.Y);
    }

    public static Vec2f operator*(Vec2f a, double t) {
        return new Vec2f(a.X * t, a.Y * t);
    }

    public static Vec2f operator*(double t, Vec2f a) {
        return new Vec2f(a.X * t, a.Y * t);
    }

    // a???b = |a||b|cos??
    public double Dot(Vec2f other) {
        return X * other.X + Y * other.Y;
    }

    public double Cross(Vec2f other) {
        return X * other.Y - Y * other.X;
    }

    public Vec2f Normalized() {
        var m = Magnitude();
        if (m != 0 && m != 1) {
            return new Vec2f(X / m, Y / m);
        }
        return this;
    }

    public double Magnitude() {
        return Math.Sqrt(X * X + Y * Y);
    }

    public double SqrMagnitude() {
        return X * X + Y * Y;
    }

    public static double Distance(Vec2f a, Vec2f b) {
        return (a - b).Magnitude();
    }
}

Measured memory_bytes: 9472
#include<bits/stdc++.h>
#define li long int
#define ll long long int
#define vec(x) vector<x> 
#define st(x) set<x> 
#define mpp(x,y) map<x,y> 
#define pi(x,y) pair<x,y>
#define forf(i,x,y) for(ll i=x;i<y;i++)
#define forl(i,x) for(ll i=x-1;i>=0;i--)
#define rev(x) reverse(x.begin(),x.end())
#define mem(x,a) memset(x,a,sizeof(x))
#define mod 1000000007
#define nxt_per(x) next_permutation(x.begin(),x.end())
#define pb push_back
#define ub upper_bound
#define lb lower_bound
#define mp make_pair
#define vp(x,y) vec(pi(x,y) )
#define all(x) x.begin(),x.end()

using namespace std;

int main()
{
	int n,m;
	cin>>n>>m;
	vp(int,int) v(m);
	forf(i,0,m)
		cin>>v[i].second>>v[i].first;
	sort(all(v));
	int count=0,a=-1;
	forf(i,0,m)
	{	if(v[i].second<a)
			continue;
		count++;
		a=v[i].first;
	}
	cout<<count;
	return 0;
}

Measured memory_bytes: 1152