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

using namespace std;

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

#define fi first
#define se second
#define mp make_pair
#define fastIO ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);

int main(){
  fastIO;
  int n;
  cin >> n;
  ll a[n];
  for(int i = 0 ;i < n; i ++ ){
    cin >> a[i];
  }
  ll li = 2, ri = 2;
  ll xi, yi;
  for(int i = n - 1; i >= 0 ; i -- ){
    xi = ((li + a[i] - 1) / a[i]) * a[i];
    yi = (ri / a[i]) * a[i];
    if(xi >= li && xi <= ri && yi >= li && yi <= ri){
      li = xi;
      ri = yi + a[i] - 1;
    }
    else{
      cout << -1;
      return 0;
    }
  }
  cout << li << " " << ri << "\n";
  return 0;
}

Measured memory_bytes: 1024
import std.stdio, std.string, std.conv;
import std.range, std.algorithm, std.array, std.typecons, std.container;
import std.math, std.numeric, core.bitop;


void main() {
    int a, b, c, d;
    scan(a, b, c, d);

    writeln(abs(a-c) <= d || max(abs(a-b), abs(b-c)) <= d ? "Yes" : "No");
}







































void scan(T...)(ref T args) {
    import std.stdio : readln;
    import std.algorithm : splitter;
    import std.conv : to;
    import std.range.primitives;

    auto line = readln().splitter();
    foreach (ref arg; args) {
        arg = line.front.to!(typeof(arg));
        line.popFront();
    }
    assert(line.empty);
}



void fillAll(R, T)(ref R arr, T value) {
    static if (is(typeof(arr[] = value))) {
        arr[] = value;
    }
    else {
        foreach (ref e; arr) {
            fillAll(e, value);
        }
    }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define pb push_back
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define rep(i, n) FOR(i, 0, n)
#define ll long long
using namespace std;

const ll P = 1000000007;
const long long INF = 1LL << 60;
int gcd(int a, int b) { return b != 0 ? gcd(b, a % b) : a; }
int lcm(int a, int b) { return a / gcd(a, b) * b; }
vector<char> alphabet = {'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 main(){
  ll N;
  cin >> N;
  vector<char> name;
  int count = 0;
  ll ex = 1;
  while(N>0)
  {
    if(N%26==1)
    {
      name.push_back(alphabet[0]);
    }
    else if(N%26==2)
    {
      name.push_back(alphabet[1]);
    }
    else if(N%26==3)
    {
      name.push_back(alphabet[2]);
    }
    else if(N%26==4)
    {
      name.push_back(alphabet[3]);
    }
    else if(N%26==5)
    {
      name.push_back(alphabet[4]);
    }
    else if(N%26==6)
    {
      name.push_back(alphabet[5]);
    }
    else if(N%26==7)
    {
      name.push_back(alphabet[6]);
    }
    else if(N%26==8)
    {
      name.push_back(alphabet[7]);
    }
      else if(N%26==9)
    {
      name.push_back(alphabet[8]);
    }
    else if(N%26==10)
    {
      name.push_back(alphabet[9]);
    }
    else if(N%26==11)
    {
      name.push_back(alphabet[10]);
    }
    else if(N%26==12)
    {
      name.push_back(alphabet[11]);
    }
    else if(N%26==13)
    {
      name.push_back(alphabet[12]);
    }
    else if(N%26==14)
    {
      name.push_back(alphabet[13]);
    }
    else if(N%26==15)
    {
      name.push_back(alphabet[14]);
    }
    else if(N%26==16)
    {
      name.push_back(alphabet[15]);
    }
    else if(N%26==17)
    {
      name.push_back(alphabet[16]);
    }
    else if(N%26==18)
    {
      name.push_back(alphabet[17]);
    }
    else if(N%26==19)
    {
      name.push_back(alphabet[18]);
    }
    else if(N%26==20)
    {
      name.push_back(alphabet[19]);
    }
    else if(N%26==21)
    {
      name.push_back(alphabet[20]);
    }
    else if(N%26==22)
    {
      name.push_back(alphabet[21]);
    }
    else if(N%26==23)
    {
      name.push_back(alphabet[22]);
    }
    else if(N%26==24)
    {
      name.push_back(alphabet[23]);
    }
    else if(N%26==25)
    {
      name.push_back(alphabet[24]);
    }
    else if(N%26==0)
    {
      name.push_back(alphabet[25]);
      N --;
    }
    N /= 26;
  }
  int M = name.size();
  rep(i,M)
  {
    cout << name[M-1-i];
  }
  return 0;
}


Measured memory_bytes: 3600
/*
 * wafuIroha.cpp
 *
 *  Created on: 2020/02/23
 *      Author: black
 */
#include <iostream>
#include <algorithm>
#include <utility>
using namespace std;

int main(){
	int k, s, z;
	cin >> k >> s;
	int count = 0;

	for (int i = 0; i <= k; ++i){
		for (int j = 0; j <= k; ++j){
			z = s - i - j;
			if (z > k || z < 0){
				continue;
			}
			if (i + j + z ==s){
				count++;
			}

		}
	}

	cout << count << endl;

	return 0;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {

    public static void main(String[] args) {
	    // write your code here
        Scanner sc = new Scanner(System.in);

        int r = sc.nextInt();
        int d = sc.nextInt();
        int start = sc.nextInt();

        for (int i = 1; i <= 10; i++) {
            int value = r * start - d;
            start = value;
            // 出力
            System.out.println(value);
        }
    }
}

Measured memory_bytes: 21844
#include<cctype>
#include<cstdio>
#include<cstring>

int getint(){
	int x=0,f=0;char ch=getchar();
	while(!isdigit(ch)) f|=ch=='-',ch=getchar();
	while(isdigit(ch)) x=(x<<1)+(x<<3)+(ch^48),ch=getchar();
	return f?-x:x;
}

signed main(){
	int n=getint();
	if(n<1200) printf("ABC");
	else if(n<2800) printf("ARC");
	else printf("AGC");
	return 0;
}

Measured memory_bytes: 128
#------------------------template--------------------------#
import os
import sys
from math import *
from collections import *
# from fractions import *
# from heapq import*
from bisect import *
from io import BytesIO, IOBase
def vsInput():
    sys.stdin = open('input.txt', 'r')
    sys.stdout = open('output.txt', 'w')
BUFSIZE = 8192
class FastIO(IOBase):
    newlines = 0
    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None
    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()
    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()
    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)
class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")
sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
input = lambda: sys.stdin.readline().rstrip("\r\n")
ALPHA='abcdefghijklmnopqrstuvwxyz/'
M=998244353
EPS=1e-6
def Ceil(a,b): return a//b+int(a%b>0)
def value():return tuple(map(int,input().split()))
def array():return [int(i) for i in input().split()]
def Int():return int(input())
def Str():return input()
def arrayS():return [i for i in input().split()]


#-------------------------code---------------------------#
#vsInput()

print('ACL'*Int())

















    

    
    





    

    


        





    

        


    




        

        


    









    







    


















    
    
    



    
        

   











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

#define for_(i,a,b) for(int i=a;i<b;++i)
#define ALL(a) a.begin(),a.end()
using lint = long long int;

int H, W, K;
string S[10];

int compute(int cut) {
    int n_areas = __builtin_popcount(cut) + 1;
    int n_cuts = n_areas - 1;
    vector<int> sum(n_areas, 0);
    for_(x,0,W) {
        vector<int> sum_x(n_areas, 0);
        int i = 0;
        for_(y,0,H) {
            if (S[y][x] == '1') ++sum_x[i];
            if (cut >> y & 1) ++i;
        }

        bool invalid = false;
        for_(a,0,n_areas) invalid |= (sum_x[a] > K);
        if (invalid) return 1L << 30;

        bool flag = false;
        for_(a,0,n_areas) {
            sum[a] += sum_x[a];
            flag |= (sum[a] > K);
        }        
        if (flag) {
            ++n_cuts;
            swap(sum, sum_x);
        }
    }

    return n_cuts;
}

int main() {
    cin >> H >> W >> K;
    for_(i,0,H) cin >> S[i];

    int C = H - 1;
    int ans = 1L << 30;
    for (int cut=0; cut<(1<<C); ++cut) ans = min(ans, compute(cut));
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#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 INF 2e9
#define ALL(v) (v).begin(), (v).end()
using namespace std;
typedef long long ll;

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

int main()
{
	string s;
	cin >> s;
	map<char, int> m;

	REP(i, (int)s.size()){
		m[s[i]]++;
	}

	if ((m['S'] and m['N']) or (!(m['S']) and !(m['N']))){
		if ((m['E'] and m['W']) or (!(m['E']) and !(m['W']))){
			cout << "Yes" << endl;
			return 0;
		}
	}

	cout << "No" << endl;
}


Measured memory_bytes: 256
import sys
mina=10**10
L,R=map(int,input().split())
for i in range(L,R):
  for j in range(i+1,R+1):
    i=i%2019
    j=j%2019
    mina=min(mina,(i*j)%2019)
    if mina==0:
      print(0)
      sys.exit()
print(mina)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using pii = pair<int,int>;
using pll = pair<ll,ll>;
using vpii = vector<pii>;
using vpll = vector<pll>;

#define rep(i, n) for(int i=0;i<(int)n;i++)
#define rep2(i, s, n) for(int i=(s);i<(int)n;i++)
int INF=1e9+7;

int main() {
  int N;
  cin >> N;
  vi L(2*N);
  rep(i,2*N) cin >> L[i];
  sort(L.begin(),L.end());
  int ans=0;
  rep(i,N) ans+=L[2*i];
  cout << ans << endl;
}

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

using namespace std;

int main()
{
  int P, R, T, L[300], N[300][300];
  int latte[200000], malta[200000];


  cin >> P >> R >> T;
  for(int i = 0; i < R; i++) {
    cin >> L[i];
  }
  for(int i = 0; i < P; i++) {
    for(int j = 0; j < R; j++) {
      cin >> N[i][j];
    }
  }
  for(int i = 0; i < T; i++) {
    cin >> latte[i] >> malta[i];
    --latte[i];
    --malta[i];
  }

  int ok = -1, ng = T;
  while(ng - ok > 1) {
    int mid = (ok + ng) / 2;
    ([&]
     {
       vector< vector< int > > need(P, vector< int >(R));
       vector< int > available(R);
       for(int i = 0; i < P; i++) {
         for(int j = 0; j < R; j++) need[i][j] = N[i][j];
       }
       for(int i = 0; i < R; i++) available[i] = L[i];

       for(int i = 0; i <= mid; i++) {
         --need[latte[i]][malta[i]];
         --available[malta[i]];
       }

       vector< int > live(P);
       iota(begin(live), end(live), 0);

       int sum = 0;
       while(!live.empty()) {
         vector< int > nxt;
         bool update = false;
         for(int i : live) {
           bool f = true;
           for(int j = 0; j < R; j++) {
             if(need[i][j] == 0) continue;
             f &= need[i][j] <= available[j];
           }
           if(f) {
             update = true;
             for(int j = 0; j < R; j++) available[j] += N[i][j] - need[i][j];
           } else {
             nxt.push_back(i);
           }
         }
         if(!update) return (false);
         swap(nxt, live);
       }
       return (true);
     }() ? ok : ng) = mid;
  }
  if(ok >= T - 1) cout << -1 << endl;
  else cout << ok + 2 << endl;
}

Measured memory_bytes: 5176
#include<functional>
#include<algorithm>
#include<iostream>
#include<iomanip>
#include<cstring>
#include<cstdlib>
#include<utility>
#include<string>
#include<cstdio>
#include<vector>
#include<bitset>
#include<cmath>
#include<ctime>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
using namespace std;
const int inf=2147483647,dx[]={-1,0,1,0},dy[]={0,-1,0,1};// 上 左 下 右
const int N=100005,M=1000005,K=200005,mod=1000000007;
const long long llinf=9223372036854775807ll;
//int & long long
int n,m;
int main(){
	cin>>n>>m;
	cout<<(n==m?"Yes":"No");
	return 0;
}


Measured memory_bytes: 384
import java.util.*;

public class Main {
    void run() {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] arr = new int[n];
        int[] count = new int[n];
        for (int i = 0; i< n; i++) {
            int a = sc.nextInt() - 1;
            arr[i] = a;
            count[a]++;
        }

//        debug(arr);
//        debug(count);

        long total = 0;
        for (int i = 0; i < n; i++) {
            total += ((long) count[i]) * (count[i] - 1) / 2;
        }

//        debug(total);

        for (int i = 0; i< n; i++) {
            System.out.println(total - (count[arr[i]] - 1));
        }

    }

    void debug(Object... os) {
        System.err.println(Arrays.deepToString(os));
    }

    public static void main(String[] args) {
        new Main().run();
    }
}


Measured memory_bytes: 91696
#include <algorithm>
#include <cassert>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;
// const int INF = (1 << 30) - 1;
// const ll LL_INF = (1LL << 62) - 1;
// const ll MOD = 1e9 + 7;

string S;
// vector<int> A;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> S;
  // A.resize(N);
  // for (int i = 0; i < N; i++) {
  //   int tmp;
  //   cin >> tmp;
  //   A[i] = tmp;
  // }

  if (S == "ABC") {
    cout << "ARC" << endl;
  } else {
    cout << "ABC" << endl;
  }

  return 0;
}


Measured memory_bytes: 3096
#include <iostream>
#include <utility>
#include <set>
#define ll long long
#define inf 1000000000000000

using namespace std;

int main () {
  ll n, m;
  cin >> n >> m;
  ll box[1001][1001];
  ll d[1001];
  for (ll i = 0; i <= 1000; i++) {
    d[i] = inf;
  }
  ll a[m], b[m], c[m];
  for (ll i = 0; i < m; i++) {
    cin >> a[i] >> b[i] >> c[i];
    c[i] = c[i] * -1;
  }  
  d[1] = 0;
  ll before = 0;
  ll after = 0;
  for (ll i = 0; i < n; i++) {
    for (ll j = 0; j < m; j++) {
      if (d[b[j]] > d[a[j]] + c[j]) {
        d[b[j]] = d[a[j]] + c[j];  
      } 
    }  
    if (i == n - 2) {
      before = d[n];  
    }
    if (i == n - 1) {
      after = d[n];  
    }
  }
  if (before > after) {
    cout << "inf" << endl;
    return 0;
  }
  cout << d[n] * - 1 << endl;
  
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
#include <map>
#include <set>
#include <unordered_set>
#include <unordered_map>
#define ll long long
#define fi first
#define se second
#define pb push_back
#define me memset
const int N = 1e6 + 10;
const int M = 1e9 + 7;
using namespace std;
typedef pair<int,int> PII;
typedef pair<long,long> PLL;

ll x;


int main() {
    ios::sync_with_stdio(false);
        cin>>x;
         ll s1=x/500;
         x=x%500;
         ll s2=x/5;
         printf("%lld",s1*1000+s2*5);



    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <map>
#include <vector>
#include <cmath>
#include <string>
#include <cstring>
#include <algorithm>
#include <climits>
#include <stack>
#include <queue>
#include <set>
#include <cctype>
#include <bitset>
#include <type_traits>

#include <list>
using namespace std;

#define REP(i, n) for (long long i = 0; i < (n); ++i)
#define rep(i, a, b) for (long long i = a; i < (b); ++i)
#define YES(j) cout << (j ? "YES" : "NO") << endl;
#define Yes(j) std::cout << (j ? "Yes" : "No") << endl;
#define yes(j) std::cout << (j ? "yes" : "no") << endl;

int main(void)
{
    long long n, k;
    cin >> n >> k;
    vector<pair<long long, long long>> pr;
    REP(i, n)
    {
        long long a, b;
        cin >> a >> b;
        pr.push_back(make_pair(a, b));
    }
    sort(pr.begin(), pr.end());
    long long pos = 0;
    for (pair<long long, long long> p : pr)
    {
        if (pos + p.second >= k)
        {
            cout << p.first << endl;
            return 0;
        }
        pos += p.second;
    }
}

Measured memory_bytes: 2420
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define mx 1000000
vector<ll>v[mx];
bool vis[mx];
ll dis[mx];
void bfs(ll y)
{
    vis[y]=1;
    queue<ll>q;
    q.push(y);
    while(!q.empty())
    {
        q.pop();
        for(auto a:v[y])
        {
            if(vis[a])
            {
                continue;
            }
            q.push(a);
            vis[a]=1;
            dis[a]=dis[y]+1;
        }
        y=q.front();
    }
}

int main()
{

    ll n;
    cin>>n;
    for(int i=0;i<n;i++)
    {
        ll x;
        cin>>x;
        v[i+1].pb(x);
        //v[x].pb(i+1);
    }
    bfs(1);
    if(vis[2])
    {
        cout<<dis[2]<<endl;
    }
    else{
        cout<<"-1"<<endl;
    }

}


Measured memory_bytes: 31080
def test():
    w,a,b = map(int,input().split())
    if a < b:
        c = b - (a+w)
        if c > 0:
            print(c)
        else:
            print(0)
    else:
        c = a - (b+w)
        if c > 0:
            print(c)
        else:
            print(0)


if __name__ == "__main__":
    test()


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

int main() {
    int a,b,c,d;
    cin >> a >> b >> c >> d;
    //cout << a << " " << b << " " << c << " " << d << endl;
    if(a>c){
        swap(a,c); swap(b,d);
    }
    //cout << a << " " << b << " " << c << " " << d << endl;
    if(c>b){//abcd
        cout << "0" << endl;
    }
    else if(b>=d){//acdb
        cout << d-c << endl;
    }
    else if(c<=b&&b<=d){//acbd
        cout << b-c << endl;
    }

    return 0;
}

Measured memory_bytes: 256
n,m = list(map(int, input().split()))
s = input()
t = input()
import math

# 良い文字列が作れるなら、答えはLCM(n, m)となる
gcd = math.gcd(n, m)
if s[::n//gcd] == t[::m//gcd]:
    print(n * m // gcd)
else:
    print(-1)

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

const int mod = 1000000007;
struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const {
    mint res(*this);
    return res+=a;
  }
  mint operator-(const mint a) const {
    mint res(*this);
    return res-=a;
  }
  mint operator*(const mint a) const {
    mint res(*this);
    return res*=a;
  }
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const {
    return pow(mod-2);
  }
  mint& operator/=(const mint a) {
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const {
    mint res(*this);
    return res/=a;
  }
};

mint ch(int n, int a){
	mint x = 1, y = 1;
	rep(i, a){
		x *= (n-i);
		y *= (i+1);
	}
	
	return x/y;
}

int main(){
	int n, a, b;
	cin >> n >> a >> b;
	mint ans = 2;
	ans = ans.pow(n);
	ans -= 1;
	ans -= ch(n, a);
	ans -= ch(n, b);
	cout << ans.x << endl;
	return 0;
}

Measured memory_bytes: 256
/*

結果:
*/
#define _USE_MATH_DEFINES
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <limits.h>  
#include <stdbool.h>   
#define inf (INT_MAX-1)
#define INF 9223372036854775807
#define PI 3.14159265358979323846;
#define EPS 1e-10
#define sq(n) ((n)*(n))
#define rep(i,n) for(i=0;i<n;i++)
#define rev(i,n) for(i=n-1;i>=0;i--)
/*
#define sort(a,n) qsort(a,n,sizeof(TYPE),cmp)
#define sort_r(a,n) qsort(a,n,sizeof(TYPE),cmp_r)
*/
#define chsort(s,n) qsort(s,n,sizeof(char),cmp)
#define chsort_r(s,n) qsort(s,n,sizeof(char),char_cmp_r)
#define TYPE long long
#define ll long long
#define MEMSET(a) memset(a,0,sizeof(a))
#define MEMSET_U(a) memset(a,-1,sizeof(a))
const int mod = (int)1e09 + 7;

//#define DEBUG1
//#define DEBUG2
//#define DEBUGF
#define DUMMY

int in(void) { int i; scanf("%d", &i); return i; }
long long llin(void) { long long i; scanf("%lld", &i); return i; }
double din(void) { double i; scanf("%lf", &i); return i; }
void chin(char s[]) { scanf("%s", s); }

void print(int a) { printf("%d\n", a); }
void llprint(long long a) { printf("%lld\n", a); }
void dprint(double a) { printf("%.10f\n", a); }
void print2(int a, int b) { printf("%d %d\n", a, b); }
int Max(int a, int b) { if (a>b) { return a; }return b; }
int Min(int a, int b) { if (a<b) { return a; }return b; }
long long llmax(long long a, long long b) { return a > b ? a : b; }
long long llmin(long long a, long long b) { return a < b ? a : b; }
double dmax(double a, double b) { return a > b ? a : b; }
double dmin(double a, double b) { return a < b ? a : b; }
//long long llmax(long long a, long long b) { return a > b ? a : b; }
//long long llmin(long long a, long long b) { return a < b ? a : b; }
//double dmax(double a, double b) { return a > b ? a : b; }
int cmp(const void *a, const void *b) { return *(TYPE *)a - *(TYPE *)b; }
int cmp_r(const void *a, const void *b) { return *(TYPE *)b - *(TYPE *)a; }
int char_cmp(const void *a, const void *b) { return strcmp((char *)a, (char *)b); }
int char_cmp_r(const void *a, const void *b) { return strcmp((char *)b, (char *)a); }
void swap(int *a, int *b) { int t = *a; *a = *b; *b = t; }
int ABS(int a) { return a >= 0 ? a : -a; }



int main() {
	int A, B,cnt=0;
	scanf("%d%d", &A, &B);
	for (int i = A; i <= B; i++) {
		if (i / 10000 == i % 10 && (i / 1000)%10 == (i % 100)/10) {
			cnt++;
		}
	}
		printf("%d\n", cnt);

#ifdef DEBUGF
	getch();
#endif
	return 0;
}

Measured memory_bytes: 128
fun main(args: Array<String>) {
    a104(readLineList())
}

fun readLineList(): Array<String> {
    val lineList = mutableListOf<String>()
    while (true) {
        val line = readLine()
        if (line.isNullOrBlank()) {
            break
        } else {
            lineList.add(line!!)
        }
    }
    return lineList.toTypedArray()
}

fun a104(args: Array<String>) {
    if (args.size != 1) {
        throw IllegalArgumentException()
    }
    val rate = args[0].toInt()
    println(when {
        rate < 1200 -> "ABC"
        rate < 2800 -> "ARC"
        else -> "AGC"
    })
}



Measured memory_bytes: 31744
a, b, k = map(int, input().split())
if b - a + 1 >= 2 * k:
    for i in range(k):
        print(a + i)
    for i in range(k):
        print(b - k  + 1 + i)
else:
    for i in range(a, b + 1):
        print(i)


Measured memory_bytes: 3060
import sys
sys.setrecursionlimit(10**6)
from math import floor,ceil,sqrt,factorial,log
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict,deque
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
from copy import deepcopy
from operator import itemgetter
from fractions import gcd
mod = 10 ** 9 + 7
inf = float('inf')
ninf = -float('inf')
 
#整数input
def ii(): return int(sys.stdin.readline().rstrip()) #int(input())
def mii(): return map(int,sys.stdin.readline().rstrip().split())
def limii(): return list(mii()) #list(map(int,input().split()))
def lin(n:int): return [ii() for _ in range(n)]
def llint(n: int): return [limii() for _ in range(n)]
#文字列input
def ss(): return sys.stdin.readline().rstrip() #input()
def mss(): return sys.stdin.readline().rstrip().split()
def limss(): return list(mss()) #list(input().split())
def lst(n:int): return [ss() for _ in range(n)]
def llstr(n: int): return [limss() for _ in range(n)]

#本当に貪欲法か？ DP法では？？
#本当に貪欲法か？ DP法では？？
#本当に貪欲法か？ DP法では？？
n=ii()
arr=[]
for i in range(n):
    s=ss()
    arr.append(s)

print(len(list(set(arr))))

Measured memory_bytes: 107420
#define _USE_MATH_DEFINES
 
#include <bits/stdc++.h> 
 
#define len(x) (int)((x).size())
#define endl '\n'
#define x first
#define y second
#define int long long
#define double long double
#define all(a) (a).begin(), (a).end()
 
#ifdef LOCAL
	#define dbg(x) cout << #x << " = " << x << endl;
#else 
	#define dbg(x)
#endif 
 
using namespace std;
 
void solve(); signed main() {
#ifdef LOCAL
    freopen("file1.txt", "r", stdin);                                       
    freopen("file2.txt", "w", stdout);
#endif
    srand(time(0));
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    cout.setf(ios::fixed); cout.precision(15);
    solve();  	
}

void solve() {
	int n, k;
	cin >> n >> k;
	k += 3 * n;

	cout << k / 2 << endl;	
}

Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <complex>
#include <cstdint>
#include <cstdio>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <tuple>
#include <utility>
#include <vector>
using namespace std;

using int64 = int64_t;

constexpr int64 MOD = 1000000007;

typedef long double ld;

int K, R, L;
ld P, E, T;

ld est(int dpt, ld l, ld r) {
    if (T < l - E || r + E < T) return 0.0;
    if (T - E <= l && r <= T + E) return 1.0;

    ld mid = (l + r) / 2;

    if (dpt == K) {
        return abs(mid - T) < E ? 1.0 : 0.0;
    }

    ld lp = mid >= T ? (1 - P) * est(dpt+1, l, mid) : P * est(dpt+1, l, mid);
    ld rp = mid >= T ? P * est(dpt+1, mid, r) : (1 - P) * est(dpt+1, mid, r);

    return lp + rp;
}

int main() {
    cin >> K >> R >> L >> P >> E >> T;
    printf("%.10Lf\n", est(0, R, L));
    return 0;
}

Measured memory_bytes: 3268
/*
	Name:
	Author: xiaruize
	Date:
*/
#pragma GCC optimize(2)
#include<algorithm>
#include<bitset>
#include<cctype>
#include<cerrno>
#include<clocale>
#include<cmath>
#include<complex>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<ctime>
#include<deque>
#include<exception>
#include<fstream>
#include<functional>
#include<limits>
#include<list>
#include<map>
#include<iomanip>
#include<ios>
#include<iosfwd>
#include<iostream>
#include<queue>
#include<set>
#include<sstream>
#include<stack>
#include<stdexcept>
#include<streambuf>
#include<string>
#include<utility>
#include<vector>
#include<cwchar>
#include<cwctype>
using namespace std;
#define ull unsigned long long
#define MOD 1000000007
#define ALL(a) (a).begin(), (a).end()
#define forn(i, n) for (int i = 0; i < int(n); i++)
#define ll long long
#define form(i,j,n) for(int i=int(j);i<=int(n);i++)
#define pb push_back
#define mk make_pair
#define pii pair<int,int>
#define pis pair<int,string>
#define sec second
#define sz(a) int((a).size())

inline int read()
{
    char ch=getchar();
    int x=0,f=1;
    while(ch<'0'||ch>'9'){if(ch=='-') f=-1;ch=getchar();}
    while(ch>='0'&&ch<='9') x=x*10+(ch^48),ch=getchar();
    return x*f;
}

int main()
{
 	ios::sync_with_stdio(false);
	cin.tie(0);
 	//freopen(".in","r",stdin);
	//freopen(".out","w",stdout);
	string s;
	cin>>s;
	for(int i=0;i<s.size();i++)
	{
		if(s[i]=='?')
		{
			cout<<'D';
		}
		else
		{
			cout<<s[i];
		}
	}
	return 0;
}


Measured memory_bytes: 3736
D, G = map(int, input().split())
pc = [list(map(int, input().split())) for i in range(D)]
ans = 10**5

for i in range(2**D):
  score = 0
  tmp = 0
  solved = [False]*D
  for j in range(D):
    if (i>>j) & 1:
      score += (j+1) * 100 * pc[j][0] + pc[j][1]
      tmp += pc[j][0]
      solved[j] = True
  if score >= G:
    ans = min(ans, tmp)
  else:
    for k in range(D-1,-1,-1):
      if solved[k] == False:
        l = 0
        while score < G and l < pc[k][0]:
          score += (k+1)*100
          tmp += 1
          l += 1
        if score >= G:
          ans = min(ans, tmp)
          break
print(ans)

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

typedef int		BOOL;
#define TRUE	1;
#define FALSE	0;

typedef struct Word
{
	char	word[31];
	int		page;
}	WORD;

WORD wordArray[100];

void input();
	BOOL is_smaller(WORD, int);
void output();

int main()
{
    input();
    output();
	
	return 0;
}

void input()
{
	int 	cnt1, cnt2;
	WORD	tempWORD;
	
	while(scanf("%s %d", tempWORD.word, &tempWORD.page) != EOF)
	{
		for(cnt1 = 0; cnt1 < 100; cnt1++)
		{
			if(wordArray[cnt1].page == 0)
			{
				strcpy(wordArray[cnt1].word, tempWORD.word);
				wordArray[cnt1].page = tempWORD.page;
				break;
			}
			else if(is_smaller(tempWORD, cnt1))
			{
				for(cnt2 = 98; cnt2 >= cnt1; cnt2--)
				{
					strcpy(wordArray[cnt2 + 1].word, wordArray[cnt2].word);
					wordArray[cnt2 + 1].page = wordArray[cnt2].page;
				}
				strcpy(wordArray[cnt1].word, tempWORD.word);
				wordArray[cnt1].page = tempWORD.page;
				break;
			}
		}
	}
}

BOOL is_smaller(WORD tempWORD, int cnt)
{
	if(strcmp(tempWORD.word, wordArray[cnt].word) < 0)
	{
		return TRUE;
	}
	else if(strcmp(tempWORD.word, wordArray[cnt].word) == 0)
	{
		if(tempWORD.page < wordArray[cnt].page)
		{
			return TRUE;
		}
		else
		{
			return FALSE;
		}
	}
	else
	{
		return FALSE;
	}
}

void output()
{
	int		output_cnt = 0;
	char	last_print_word[31] = "";

	while(wordArray[output_cnt].page != 0)
	{
		if(strcmp(last_print_word, "") == 0)
		{
			printf("%s\n", wordArray[output_cnt].word);
			strcpy(last_print_word, wordArray[output_cnt].word);
		}
		else if(strcmp(wordArray[output_cnt].word, last_print_word) != 0)
		{
			printf("\n%s\n", wordArray[output_cnt].word);
			strcpy(last_print_word, wordArray[output_cnt].word);
		}
		else
		{
			printf(" ");
		}
		printf("%d", wordArray[output_cnt].page);
		output_cnt++;
	}
	printf("\n");
}

Measured memory_bytes: 640
import java.util.*;
import java.io.*;
import static java.util.Arrays.*;
import static java.util.Collections.*;
import static java.lang.Math.*;
 
 
public class Main{
 
    public static void main(String args[]){
        int n=100;
        int i,j,k,v,l;
        int a[]=new int[n+1];
         Scanner sc = new Scanner(System.in);
        k=Integer.parseInt(sc.next());
         
        for(i=0;i<k;i++){
            a[i]=Integer.parseInt(sc.next());
        }
        for(i=0;i<k;i++){
            System.out.print(a[i]);
            if(i<k-1){
            System.out.print(" ");
            }
        }
         
        System.out.println();
        for(i=1;i<k;i++){
            v=a[i];
            j=i-1;
            while(j>=0&&a[j]>v){
                a[j+1]=a[j];
             
                j--;
            }
                a[j+1]=v;
            for(l=0;l<k;l++){
                System.out.print(a[l]);
                if(l<k-1){
                System.out.print(" ");
                }
            }
            System.out.println();
             
        }
         
    }
}

Measured memory_bytes: 24136
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.ArrayDeque;
import java.util.Collections;
import java.util.Deque;
import java.util.StringTokenizer;

public class Main {
  private static class FastScanner {
    private BufferedReader reader = null;
    private StringTokenizer tokenizer = null;

    public FastScanner(InputStream in) {
      reader = new BufferedReader(new InputStreamReader(in));
      tokenizer = null;
    }

    public String next() {
      if (tokenizer == null || !tokenizer.hasMoreTokens()) {
        try {
          tokenizer = new StringTokenizer(reader.readLine());
        } catch (IOException e) {
          throw new RuntimeException(e);
        }
      }
      return tokenizer.nextToken();
    }

    public String nextLine() {
      if (tokenizer == null || !tokenizer.hasMoreTokens()) {
        try {
          return reader.readLine();
        } catch (IOException e) {
          throw new RuntimeException(e);
        }
      }

      return tokenizer.nextToken("\n");
    }

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

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

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

    public int[] nextIntArray(int n) {
      int[] a = new int[n];
      for (int i = 0; i < n; i++)
        a[i] = nextInt();
      return a;
    }

    public long[] nextLongArray(int n) {
      long[] a = new long[n];
      for (int i = 0; i < n; i++)
        a[i] = nextLong();
      return a;
    }
  }

  public static void main(String[] args) {
    FastScanner sc = new FastScanner(System.in);
    int n = sc.nextInt();
    int m = sc.nextInt();
    long k = sc.nextLong();
    long[] a = sc.nextLongArray(n);
    long[] b = sc.nextLongArray(m);
    long[] suma = new long[n + 1];
    for (int i = 1; i <= n; i++) {
      suma[i] = suma[i - 1] + a[i - 1];
    }
    long[] sumb = new long[m + 1];
    for (int i = 1; i <= m; i++) {
      sumb[i] = sumb[i - 1] + b[i - 1];
    }
    int max = 0;
    for (int i = 0; i <= n && k >= suma[i]; i++) {
      int count = i;
      long time = k - suma[i];
      int left = 0;
      int right = m + 1;
      while (right - left > 1) {
        int middle = left + (right - left) / 2;
        if (time >= sumb[middle]) left = middle;
        else right = middle;
      }
      count += left;
      max = Math.max(max, count);
    }
    System.out.println(max);
  }
}

Measured memory_bytes: 63116
using System;
using System.Text;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using static System.Console;
using static System.Math;

namespace NotFounds
{
    public class Program
    {
        public static void Main(string[] args)
        {
            var sw = new System.IO.StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);
            new Program().Solve(new ConsoleInput(Console.In, ' '));
            Console.Out.Flush();
        }

        public void Solve(ConsoleInput cin)
        {
            var N = cin.ReadInt;
            var A = cin.ReadInt;
            var x = new int[N + 1];
            for (int i = 0; i < N; ++i)
                x[i + 1] = cin.ReadInt;

            // dp[i][j] = iまででjを作る組み合わせ
            var dp = new long[N + 1, 3000];
            dp[0, 0] = 1;
            for (int i = 1; i <= N; i++)
            {
                for (int j = i - 1; j >= 0; j--)
                {
                    for (int k = 0; k <= N * 50; k++)
                    {
                        dp[j + 1, k + x[i]] += dp[j, k];
                    }
                }
            }
            var ans = 0L;
            for (int i = 1; i <= N; i++)
                ans += dp[i, i * A];
            WriteLine(ans);
        }
    }

    public class ConsoleInput
    {
        private readonly System.IO.TextReader _stream;
        private char _separator = ' ';
        private Queue<string> inputStream;
        public ConsoleInput(System.IO.TextReader stream, char separator = ' ')
        {
            this._separator = separator;
            this._stream = stream;
            inputStream = new Queue<string>();
        }
        public string Read
        {
            get
            {
                if (inputStream.Count != 0) return inputStream.Dequeue();
                string[] tmp = _stream.ReadLine().Split(_separator);
                for (int i = 0; i < tmp.Length; ++i)
                    inputStream.Enqueue(tmp[i]);
                return inputStream.Dequeue();
            }
        }
        public string ReadLine { get { return _stream.ReadLine(); }}
        public int ReadInt { get { return int.Parse(Read); }}
        public long ReadLong { get { return long.Parse(Read); }}
        public double ReadDouble { get { return double.Parse(Read); }}
        public string[] ReadStrArray(long N) { var ret = new string[N]; for (long i = 0; i < N; ++i) ret[i] = Read; return ret;}
        public int[] ReadIntArray(long N) { var ret = new int[N]; for (long i = 0; i < N; ++i) ret[i] = ReadInt; return ret;}
        public long[] ReadLongArray(long N) { var ret = new long[N]; for (long i = 0; i < N; ++i) ret[i] = ReadLong; return ret;}
        public void ReadIntArrays(long N, out int[] A, out int[] B) { A = new int[N]; B = new int[N]; for (long i = 0; i < N; ++i) { A[i] = ReadInt; B[i] = ReadInt; }}
    }
}


Measured memory_bytes: 13340
#include<set>
#include<map>
#include<list>
#include<stack>
#include<queue>
#include<cmath>
#include<cstdio>
#include<cctype>
#include<string>
#include<vector>
#include<climits>
#include<cstring>
#include<cstdlib>
#include<iostream>
#include<algorithm>
#define endl '\n'
#define rtl rt<<1
#define rtr rt<<1|1
#define lson rt<<1, l, mid
#define rson rt<<1|1, mid+1, r
#define maxx(a, b) (a > b ? a : b)
#define minn(a, b) (a < b ? a : b)
#define zero(a) memset(a, 0, sizeof(a))
#define INF(a) memset(a, 0x3f, sizeof(a))
#define IOS ios::sync_with_stdio(false)
#define _test printf("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n")
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef pair<ll, ll> P2;
const double pi = acos(-1.0);
const double eps = 1e-7;
const ll MOD =  1000000007LL;
const int INF = 0x3f3f3f3f;
const int _NAN = -0x3f3f3f3f;
const double EULC = 0.5772156649015328;
const int NIL = -1;
template<typename T> void read(T &x){
    x = 0;char ch = getchar();ll f = 1;
    while(!isdigit(ch)){if(ch == '-')f*=-1;ch=getchar();}
    while(isdigit(ch)){x = x*10+ch-48;ch=getchar();}x*=f;
}
const int maxn = 1e5+10;
ll ans[60];
int main(void) {
    for (int i = 1; i<=60; ++i)
        ans[i] = 2LL*ans[i-1] + 1;
    ll n;
    while(~scanf("%lld", &n)) {
        for (int i = 1; i<=60; ++i) {
            ll t = 1; t <<= i;
            if (n<t) {
                printf("%lld\n", ans[i]);
                break;
            }
        }
    }
    return 0;
}

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

using namespace std;

int main(){
    int n;
    cin >> n;
    vector<long int> l(n);
    for(int i = 0; i < n; ++i)cin >> l[i];

    int ans = 0;

    for(int i = 0; i < n; ++i){
        for(int j = i + 1; j < n; ++j){
            for(int k = j + 1; k < n; ++k){
                if(l[i] != l[j] && l[j] != l[k] && l[k] != l[i] && l[i] + l[j] > l[k] && l[j] + l[k] > l[i] && l[k] + l[i] > l[j]){
                    cerr << "(" << i << "," << j << "," << k << ")" << endl;
                    ans++;
                }
            }
        }
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 3652
import math as m
import functools


def int_reverse(num):
    num_len = len(bin(num))-2
    f = 2**num_len-1
    return num ^ f

n = int(input())
A = [int(input()) for i in range(n)]
lsbs = [[i for i in range(int(m.log2(a))+1) if (a>>i)&1][0] for a in A]
nim = functools.reduce(lambda x,y:x^y, A)

cnt = 0
for lsb in reversed(sorted(lsbs)):
    if nim == 0:
        break
    if int(m.log2(nim)) == lsb:
        nim = int_reverse(nim)
        cnt += 1

ans = cnt if(nim == 0) else -1
print(ans)


Measured memory_bytes: 9608
import numpy as np

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

B = np.array(list(map(int, input().split())))
A = np.array([list(map(int, input().split())) for i in range(n)])

C = np.dot(A, B.T) + c
print(sum(np.where(C > 0, 1, 0)))


Measured memory_bytes: 16988
import java.util.Arrays;
import java.util.Scanner;

// https://atcoder.jp/contests/abc138/tasks/abc138_c
public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();

		int[] arrayV = new int[N];
		for(int i=0;i<arrayV.length;i++) {
			arrayV[i] = sc.nextInt();
		}
		sc.close();

		Arrays.sort(arrayV);

		double ans = arrayV[0];

		for(int i = 1;i<N;i++) {
			ans = (ans + arrayV[i])/2;

		}

		System.out.println(ans);

	}
}


Measured memory_bytes: 22996
#include<stdio.h>

void trace(int A[], int N) {
    for(int i = 0; i < N; i++) {
        if(i > 0) { printf(" "); }
        printf("%d", A[i]);
    }
    printf("\n");
}

void insertionSort(int A[], int N) {
    int v, j;
    for(int i = 1; i < N; i++) {
        v = A[i];
        j = i - 1;
        while(j >= 0 && v < A[j]) {
            A[j + 1] = A[j];
            j--;
        }
        A[j + 1] = v;
        trace(A, N);
    }
}

int main() {
    int N;
    int A[100];
    scanf("%d", &N);
    for(int i = 0; i < N; i++) { scanf("%d", &A[i]); }
    trace(A, N);
    insertionSort(A, N);
    return 0;
}



Measured memory_bytes: 2752
n = int(input())
heights = [int(i) for i in input().split()]

def check(num):
    for i in range(num):
        if heights[i] > heights[num]:
            return 0

    return 1

ans = 0

for i in range(n):
    if check(i) == 1:
        ans = ans + 1

print(ans)

Measured memory_bytes: 3060
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int P[] = new int[N];
        int A[] = new int[N+1];
        
        for(int i = 0; i < N; i++){
            P[i] = sc.nextInt();
            A[P[i]] = i + 1;
        }
        
        TreeSet<Integer> Piterator = new TreeSet<>();
        Piterator.add(0);
        Piterator.add(N+1);
        
        long S = 0;
        
        for(int i = N; i >= 1; i--){
            int Xi = A[i];
            
            int y = Piterator.higher(Xi);
            int z = N + 1;
            if( y != N +1) {
                z = Piterator.higher((int)y);
            }
            
            int x = Piterator.lower(Xi);
            int w = 0;
            if(x != 0) {
                w = Piterator.lower((int)x);
            }
            
            long Ci = (x - w) * (y - Xi) + (Xi - x) * (z - y);
            S += Ci * i;
            Piterator.add(Xi);
        }
        System.out.println(S);
    }
}


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

using namespace std;
#define reg register
#define rep(i, a, b) for (reg int i = (int) a; i <= (int) b; i++)
#define rev(i, a, b) for (reg int i = (int) a; i >= (int) b; i--)
#define _r read()

inline int read();

int main() {
	unsigned long long k = _r, a = _r, b = _r;
	if (b <= a + 1) {
		cout << k + 1 << endl;
		return 0;
	}
	if (k < a - 1) {
		cout << k + 1 << endl;
		return 0;
	}
	k -= a - 1;
	a += (k / 2) * (b - a) + (k % 2);
	cout << a << endl;
	return 0;
}

inline int read() {
	reg int a = 0, c = getchar(), s = c == '-';
	while (!isdigit(c)) c = getchar();
	while (isdigit(c)) a = (a << 1) + (a << 3) + (c ^ 48), c = getchar();
	return s ? -a : a;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, from, to) for (int i = from; i < (to); ++i)
#define mp(x,y) make_pair(x,y)
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x).size()
#define pb push_back
using ll = long long;
using vin=vector<int>;
using vvin=vector<vin>;
using vll=vector<ll>;
using vvll=vector<vll>;
using vst=vector<string>;
using P = pair<ll,ll>;
const int inf=1e9+7;
const ll INF=9e18;
template <typename T> bool chmin(T &a, const T& b){if(a > b){a = b;return true;}return false;}
template <typename T> bool chmax(T &a, const T& b){if(a < b){a = b;return true;}return false;}
template<class T> inline void Yes(T condition){ if(condition) cout << "Yes" << endl; else cout << "No" << endl; }
template<class T> inline void YES(T condition){ if(condition) cout << "YES" << endl; else cout << "NO" << endl; }
const int dx[4] = { 1, 0, -1, 0 };
const int dy[4] = { 0, 1, 0, -1 };

int main(){cout<<fixed<<setprecision(20);
		   int n;
           int h,w;
           cin>>n>>h>>w;
           int ans=0;
           rep(i,0,n){
            int p,q;
             cin>>p>>q;
             if(p>=h&&q>=w)ans++;
           }
           cout<<ans<<endl;
}

Measured memory_bytes: 3628
x = int(input())

def judge_prime(x):
    if x == 1: return False
    if x == 2: return True
    n = int(x ** 0.5) + 1
    for i in range(2, n):
        if x % i == 0:
            return False
    return True

if x != 2:
    x = x + 1 - x % 2
while not judge_prime(x):
    x += 2
print(x)


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

int main(){
    int n;
    cin >> n;
    long long  ans=0;
    long long c[10][10];
    for(int i=0; i<10; i++){
        for(int j=0; j<10; j++){
            c[i][j]=0;
        }
    }
    for(int a=1; a<=n; a++){
        int m[7];
        int t=a;
        int d=0;
        for(int i=1; i<7; i++){
            if(t!=0) d++;
            m[i] = t%10;
            t/=10;
        }
        c[m[d]][m[1]]++;
    }
    for(int i=1; i<=9; i++){
        for(int j=1; j<=9; j++){
            ans += c[i][j]*c[j][i];
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Jaynil
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        EGetEverything solver = new EGetEverything();
        solver.solve(1, in, out);
        out.close();
    }

    static class EGetEverything {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int n = in.nextInt();
            int m = in.nextInt();
            int a[] = new int[m];
            int doa[] = new int[m];
            long dp[][] = new long[m + 1][(int) Math.pow(2, n)];
            for (int i = 0; i < m; i++) {
                a[i] = in.nextInt();
                int b = in.nextInt();
                for (int j = 0; j < b; j++) {
                    doa[i] |= 1 << in.nextInt() - 1;
                }
            }
            for (int i = 0; i <= m; i++) {
                for (int j = 0; j < Math.pow(2, n); j++) {
                    dp[i][j] = Integer.MAX_VALUE;
                }
            }
            dp[0][0] = 0;
            for (int i = 0; i < m; i++) {
                for (int j = 0; j < Math.pow(2, n); j++) {
                    dp[i + 1][j] = dp[i + 1][j - (j & doa[i])] + a[i];
                    dp[i + 1][j] = Math.min(dp[i][j], dp[i + 1][j]);
                }
            }
            out.println(dp[m - 1][(int) Math.pow(2, n) - 1] != Integer.MAX_VALUE ? dp[m - 1][(int) Math.pow(2, n) - 1] : -1);
        }

    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

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

    }
}



Measured memory_bytes: 83364