akhauriyash/Code-Regression huggingface dataset:
a = [list(map(int,input().split())) for _ in range(3)]
n = int(input())
bingo = [[False,False,False] for i in range(3)]
for i in range(n):
    b = int(input())
    for j in range(3):
        for k in range(3):
            if a[j][k] == b:
                bingo[j][k] = True

ans = False
for i in range(3):
    q = True
    for j in range(3):
        if  not bingo[i][j]:
            q = False
            break
    if q:
        print("Yes")
        exit()
for i in range(3):
    q = True
    for j in range(3):
        if  not bingo[j][i]:
            q = False
            break
    if q:
        print("Yes")
        exit()
q = True
for i in range(3):
    if not bingo[i][i]:
        q = False
        break
if q:
    print("Yes")
    exit()

q = True
for i in range(3):
    if not bingo[i][2-i]:
        q = False
        break
if q:
    print("Yes")
    exit()

print("No")


Measured memory_bytes: 38256
#
# 　　  ⋀_⋀　 
#　　  (･ω･)  
# .／ Ｕ ∽ Ｕ＼
#  │＊　合　＊│
#  │＊　格　＊│ 
#  │＊　祈　＊│ 
#  │＊　願　＊│ 
#  │＊　　　＊│ 
#      ￣
#
import sys
sys.setrecursionlimit(10**6)
input=sys.stdin.readline
from math import floor,ceil,sqrt,factorial,log #log2ないｙｐ
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
inf=float('inf')
mod = 10**9+7
def pprint(*A): 
    for a in A:     print(*a,sep='\n')
def INT_(n): return int(n)-1
def MI(): return map(int,input().split())
def MF(): return map(float, input().split())
def MI_(): return map(INT_,input().split())
def LI(): return list(MI())
def LI_(): return [int(x) - 1 for x in input().split()]
def LF(): return list(MF())
def LIN(n:int): return [I() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]
def LLIN_(n: int): return [LI_() for _ in range(n)]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def I(): return int(input())
def F(): return float(input())
def ST(): return input().replace('\n', '')
def main():
    A=LI()
    D=set()
    for a in A:
        if a in D:
            D.remove(a)
        else:
            D.add(a)
    for d in D:
        print(d)
if __name__ == '__main__':
    main()

Measured memory_bytes: 38384
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <chrono>

using namespace __gnu_pbds;
using namespace std;

#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
// order_of_key (val): returns the no. of values less than val
// find_by_order (k): returns the kth largest element.(0-based)

#define ll long long int
#define ld long double
#define ff first
#define ss second
#define pb push_back
#define pi pair<ll,ll>
#define pii pair<ll,pi >
#define ppi pair<pi,ll>
#define ppp pair<pi,pi >
#define ex(str,a,b) str.substr((int)(a),min((int)str.size()-a,(int)(b-a+1))) 
#define all(X) X.begin(),X.end()
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

// for pair comparison function(ascending order) use return (i1.ff < i2.ff);

/* string operations :
   str.substr (x,y) : returns a substring str[x],str[x+1],...str[x+y-1]
   __builtin_popcount(n) : no. of set bits in n.
*/

const int M = (1<<20)+5;
const int md = 1e9+7;

priority_queue<ll,vector<ll >,greater<ll > > pq;

ll pwr(ll a,ll n,ll m)
{
	ll p=1;
	while(n>0)
	{
		if(n%2==1)
			p=(p*a)%m;
		a=(a*a)%m;
		n=n/2;
	}
	return p;
}

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	ll a,b,k;
	cin >> a >> b >> k;
	if(k<=a)
		cout << a-k << " " << b << "\n";
	else if(k<=a+b)
		cout << 0 << " " << a+b-k << "\n";
	else
		cout << 0 << " " << 0 << "\n";
}

Measured memory_bytes: 256
//14:17
#include <iostream>
#include <string>
#include <map>
#include <vector>
#include <algorithm>
#include <queue>
using namespace std;

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

#define all(v) v.begin(),v.end()
#define INF 1<<30
#define mp make_pair
#define pb push_back

#define fi first
#define se second

#define each(it,c) for(auto it=(c).begin();it!=(c).end();it++)

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> pii;
typedef vector<pair<int, int> > vii;

typedef long long ll;
int per[10100][1000];
int ln[10100];//???????????¨????????°?????°
int main(){
	
	//stu[m] [0]?????? t[1]PC n[2]?????°?????? s
	while(1){
		vii stu[10100];
		int n,m;
		int r;
		cin >> n >> m;
		if(n==0&&m==0) break;
		cin >> r;
		rep(i,m){
			ln[i]=0;
			rep(j,1000){
				per[i][j]=0;
			}	
		}
		rep(i,r){
			int t,n,m,s;
			cin >> t >> n >> m >> s;
			m-=1;
			stu[m].pb(make_pair(t,s));
			ln[m]++;
 		}
 		rep(i,m){
 			int ms = 0;
 			int p = 0;
 			rep(j,ln[i]){
 				if(stu[i][j].se==1){

 					if(ms==0){
 						per[i][p++] = stu[i][j].fi;
 					}
 					ms++;
 				}else if(stu[i][j].se==0){
 					if(ms==1){
 						per[i][p++] = stu[i][j].fi;
 					}
 					ms--;
 				}
 			}
 			ln[i]=p;

 		}
 	// 	cout << "debug" << endl;
 	// 	rep(i,m){
		// 	rep(j,ln[i]){
		// 		cout << "j:"<<j<<""<< per[i][j] << " ";
		// 	}
		// 	cout << endl;
		// }
		// cout << endl;


		int q;
		cin >> q;
		rep(i,q){
			int ans =0;
			int ts,te,m;
			cin >> ts >> te >> m;
			m--;
			for(int j=0;j<ln[m]/2;j++){
				ans += max(0,min(te,per[m][j*2+1])-max(ts,per[m][j*2]));
			}
			// cout << "ans" << endl;
			cout << ans << endl;
		}

		

	}
	return 0;
}

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

int main()
{
    int a,b,c,d,e,k;
    cin >> a >> b >> c >> d >> e >> k;
    if(e-a > k){
        cout << ":(" << endl;
    }
    else{
        cout << "Yay!" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<utility>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<functional>
#include<math.h>
using namespace std;
#define N (1000000000+7)
#define M 998244353
#define INF 1e16
typedef long long ll;
typedef pair<ll,ll> P;
 
ll A(ll x){
    if(x>=0)return x;
    else return -x;
}
 
ll gcd(ll a, ll b) {
	if (b > a) {
		ll tmp = b;
		b = a;
		a = tmp;
	}
	if (a%b == 0)return b;
	else return gcd(b, a%b);
}

struct edge{
	ll to;
	ll cost;
};

vector<edge>g[110];

vector<P>used;

int main(void){
	int a;
	cin>>a;
	cout<<a+a*a+a*a*a<<endl;
    return 0;
}

Measured memory_bytes: 3608
M, D = map(int, input().split())
ans = 0
for m in range(1, M + 1):
    for d in range(1, D + 1):
        if d >= 10:
            d1 = d % 10
            d10 = d // 10
            if d1 >= 2 and d10 >= 2 and m == d1 * d10:
                ans += 1
print(ans)

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
int main(){
	int a,b,c;
	cin>>a;
	cin>>b;
	cin>>c;
	if(b>a)
	a=b;
	float p1;
	p1=c*1.0/a;
	int p2;
	p2=p1;
	if(p1>p2)
	p2++;
	cout<<p2;
} 

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include<cmath>
#include<cstdio>
#include<cstring>
#include<bitset>
#include<iostream>
#include<algorithm>
#include<string>
#include<utility>
#include<tuple>
#include<vector>
#include<list>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<numeric>
#include<functional>
#include<iomanip>
#include<random>

#define IOS ios::sync_with_stdio(false),cin.tie(0)
#define REP(i,n) for(ll i = 0;i < n;i++)
#define FOR(i,a,b) for(ll i = a;i < b;i++)
#define MEM(a,b) memset(a,b,sizeof(a))
#define ALL(x) (x).begin(),(x).end()
#define dump(x) cout << (x) << endl
#define LMAX 9223372036854775807LL
#define LMIN -9223372036854775807LL

using namespace std;

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

struct UnionFind {
	vector<int> data;
	UnionFind(int size) : data(size, -1) {}
	void unionSet(int x, int y) {
		x = root(x), y = root(y);
		if (x != y) {
			if (data[y] < data[x])swap(x, y);
			data[x] += data[y]; data[y] = x;
		}
	}
	bool findSet(int x, int y) {
		return root(x) == root(y);
	}
	int root(int x) {
		return data[x] < 0 ? x : data[x] = root(data[x]);
	}
	int size(int x) {
		return -data[root(x)];
	}
};

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;
}
ll digitsum(ll a) {
	int sum = 0;
	while (a) {
		sum += a % 10;
		a /= 10;
	}
	return sum;
}
int getdigit(ll a) {
	return to_string(a).size();
}
int countpow(ll a, ll b) {
	int ans = 0;
	if (b == 0)return -1;
	while (1) {
		if (a % b == 0) {
			a /= b;
			ans++;
		}
		else break;
	}
	return ans;
}
int to_num(char c) {
	if (c >= '0' && c <= '9')return (c - '0');
	else return -1;
}

struct edge { ll to, cost; };

int main() {
	IOS;
	ll n, x;
	cin >> n >> x;
	vector<ll> a(n);
	REP(i, n)cin >> a[i];
	ll ans = 0;
	REP(i, n - 1) {
		ll tm = a[i] + a[i + 1];
		if (tm - x > 0) {
			if (a[i + 1] < tm - x) {
				a[i + 1] = 0; a[i] -= tm - x - a[i + 1];
			}
			else a[i + 1] -= tm - x;

			ans += tm - x;
		}
	}
	dump(ans);
}




Measured memory_bytes: 1024
N = int(input())
S = input()
dp = [[0] * (N+2) for _ in range(N+2)]
ans = 0
for i in range(1,N):
    for d in range(1,N+1-i):
        if S[i-1] == S[i-1+d]:
            dp[i][d] = min(d, dp[i-1][d]+1)
            ans = max(ans, dp[i][d])
print(ans)

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

using namespace std;

#define llong long long int
#define ldouble long double
#define rep(i, n) for (int i = 0; i < n; ++i) 
#define stl_rep(itr, x) for (auto itr = x.begin(); itr != x.end(); ++itr)
#define stl_repr(itr, x) for (auto itr = x.begin(); itr != x.end(); ++itr)
#define all(x) x.begin(), x.end()
#define allr(x) x.rbegin(), x.rend()

constexpr static int MOD = 1000000000 + 7;
constexpr static int inf = INT_MAX / 2;
constexpr static llong INF = 1LL << 31;
constexpr static int dx[] = {1, 0, -1, 0};
constexpr static int dy[] = {0, 1, 0, -1};

vector<vector<pair<int, int> > > G;
vector<int> degree, vertex_color;
vector<bool> visited;

void dfs(int v, llong cost) {
    if (visited[v]) return;

    if (cost % 2 == 0) {
        vertex_color[v] = 1;
    }
    visited[v] = true;

    rep(i, (int)G[v].size()) {
        dfs(G[v][i].first, cost + G[v][i].second);
    }
}

int main (int argc, char *argv[]) {
    cin.tie(0); 
    ios::sync_with_stdio(false);

    int n;
    cin >> n;
    G.resize(n);
    degree.resize(n, 0);

    rep(i, n - 1) {
        int u, v, w;
        cin >> u >> v >> w;
        --u, --v;
        ++degree[u], ++degree[v];
        G[u].push_back(make_pair(v, w));
        G[v].push_back(make_pair(u, w));
    }

    int leaf = -1;
    rep(i, n) {
        if (degree[i] == 1) {
            leaf = i;
            break;
        }
    }

    vertex_color.resize(n, 0);
    visited.resize(n, false);
    dfs(leaf, 0);

    rep(i, n) cout << vertex_color[i] << endl;
    
    return 0;
}

Measured memory_bytes: 10624
#include <stdio.h>
#include <math.h>

int main(void){
    double a,b,c;
    scanf("%lf %lf %lf",&a,&b,&c);
    c=c*3.14159265/180.0;
    printf("%f\n",a*b*sin(c)/2);
    printf("%f\n",a+b+sqrt(a*a+b*b-2*a*b*cos(c)));
    printf("%f\n",b*sin(c));
    return 0;
}

Measured memory_bytes: 676
from math import gcd


def main():
    ans = 0
    k = int(input())
    for i in range(1, k+1):
        for j in range(1, k+1):
            for l in range(1, k+1):
                ans += gcd(gcd(i, j), l)
    print(ans)


if __name__ == '__main__':
    main()


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


int main (void) {
  int N;
  int A[20], B[20], C[20];

  
  cin >> N;
  for (int i=0; i<N; i++)
    cin >> A[i];
  for (int i=0; i<N; i++)
    cin >> B[i];
  for (int i=0; i<(N-1); i++)
    cin >> C[i];
  

  int S = 0;
  for (int i=0;i<N; i++) {
    S += B[A[i]-1];
    if (i>0) {
      if (A[i] - A[i-1] == 1) 
        S += C[A[i-1]-1];
    }
  }

  cout << S << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
/*#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
Apparently, the tree supports the same operations as the set 
(at least I haven't any problems with them before), but also there are two new features — 
find_by_order() — The first returns an iterator to the k-th largest element (counting from zero)
order_of_key() — the number of items in a set that are strictly smaller than our item. 
https://codeforces.com/blog/entry/11080
using namespace __gnu_pbds; */
using namespace std;
#define test() int t;cin>>t;for(int test=1;test<=t;test++)
#define int long long
#define MOD 1000000007
#define pb push_back 
#define ins insert
#define fast(); ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define ld long double
#define endl '\n'
int m(int a) {
    return ((a%MOD)+MOD)%MOD;
}
int p(int a, int b) {
    if (b==0) return (int)1;
    int x = p(a, b>>1);
    if (b & 1) return m(x*m(a*x));
    return m(x*x);
}
/*vector<int> fac; //precompute fac array
// fac.resize(n+1);
// fac[0] = 1; 
// for (int i=1; i<=n; i++)   fac[i] = m(m(fac[i-1])*m(i));
int modInverse(int n){ 
return p(n, MOD-2); 
}  
int nCrModPFermat(int n, int r){   
    if(r == 0)  return 1; 
    return m(m(m(fac[n])*m(modInverse(fac[r])))*m(modInverse(fac[n-r]))); 
} 
*/
signed main(){
    fast();
    string s;
    int k;
    cin >> k;
    cin >> s;
    if(s.length() <= k){
        cout << s << endl;
        return 0;
    }
    for(int i=0; i<k; i++){
        cout << s[i];
    }
    cout << "..." << endl;

}

Measured memory_bytes: 3652
use std::io::*;
use std::str::FromStr;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("filed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main() {
    let l:usize = read();
    let r:usize = read();
    let d:usize = read();
    let mut ans = 0;
    for i in l..=r {
        if i % d == 0 {
            ans += 1;
        }
    }
    println!("{}", ans);
}

Measured memory_bytes: 2108
import java.util.Scanner;
public class Main {

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

		int n = sc.nextInt();
		int k = sc.nextInt();
		
		System.out.println((n+1)/2 >= k ? "YES" : "NO");
		
		
		sc.close();

	}

}


Measured memory_bytes: 23764
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 ((a * b) % 2 == 0) {
      System.out.println("No");
    } else {
      System.out.println("Yes");
    }
  }
}

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

# define C continue;
# define R return

# define D double
# define I insert
# define ll long long
# define ld long double

# define ull unsigned long long
# define ui unsigned int

# define pb push_back
# define pf push_front

# define vi vector < int >
# define vc vector < char >
# define vs vector < string >
# define vb vector < bool >
# define vd vector < D >
# define vll vector < ll >
# define vull vector < ull >
# define vld vector < ld >
# define PQ priority_queue

# define vvi vector < vector < int > >
# define vvb vector < vector < bool > >
# define vvc vector < vector < char > >
# define vvs vector < vs >
# define vvll vector < vector < ll > >
# define vvd vector < vector < D > >
# define vvld vector < vector < ld > >

# define all(v) (v).begin() , (v).end()
# define allrev(v) (v).rbegin() , (v).rend()
# define allcomp(v) v.begin() , v.end() , comp
# define allrevcomp(v) v.rbegin() , v.rend() , comp

# define pii pair < int , int >
# define pll pair < ll , ll >
# define pld pair < ld , ld >
# define pDD pair < D , D >

# define vpld vector < pld >
# define vpii vector < pii >
# define vpll vector < pll >
# define vpDD vector < pDD >

# define vvpii vector < vector < pii > >
# define F first
# define S second
# define mp make_pair

# define dist(a,b,p,q) sqrt((p-a)*(p-a) + (q-b)*(q-b))

# define pp(n) printf("%.10Lf",n);
# define line cout<<"\n";
# define fast ios_base::sync_with_stdio(false) ; cin.tie(0) ; cout.tie(0);

string vow = "aeiou";
int month[] = {-1, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};

const int dxhorse[] = {-2, -2, -1, -1, 1, 1, 2, 2};
const int dyhorse[] = {1, -1, 2, -2, 2, -2, 1, -1};

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

const ld pie = 3.1415926535897932384626 ;
const ll mod = 1e9 + 7 ;

/// Tip : If a and b are positive integers ; we may say - ceil (a/b) = 1 + floor ( (a-1)/b ) .

void solve ( int test_case )
{
    int n ;
    cin >> n ;

    vi v ( n ) ;

    for ( int i=0 ; i < n ; i ++ )
        cin >> v[i] ;

    const int inf = 1e9 + 1e3 ;
    vi dp ( n , inf ) ;

    dp[0] = 0 ;

    for ( int i = 0 ; i < n ; i ++ )
    {
        for ( int j : { i + 1 , i + 2 } )
        {
            if ( j < n )
                dp[j] = min ( dp[j] , dp[i] + abs ( v[i] - v[j] ) ) ;
        }
    }

    int ans = dp[n - 1] ;
    cout << ans ;

    line
}

int main()
{fast
    int t = 1;
    // cin >> t;

    for ( int i=1 ; i <= t ; i ++ ) solve ( i ) ;
    return 0;
}


Measured memory_bytes: 1024
#include <stdio.h>

int main(void){
  int a,b,c;
  int result;

  scanf("%d%d%d",&a,&b,&c);
  
  if(a==b&&a==c&&b==c){
    result=1;
  }
  else if((a==b&&a!=c)
        ||(a==c&&a!=b)
        ||(b==c&&b!=a)
        ||(b==a&&b!=c)
        ||(c==a&&c!=b)
        ||(c==b&&c!=a)){
    result=2;
  }
  else{
    result=3;
  }
  
  printf("%d\n",result);
  
  return 0;
}

Measured memory_bytes: 2128
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class Main {

	static FastReader input = new FastReader();
	static PrintWriter out = new PrintWriter(System.out);

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

		int n = input.nextInt();
		int[] d = new int[n];
		for (int i = 0; i < n; i++) {
			d[i] = input.nextInt();
		}
		int[] m = new int[n];
		for (int i = 0; i < n; i++) {
			m[0] = i % 2 == 0 ? m[0] + d[i] : m[0] - d[i];
		}
		for (int i = 1; i < n; i++) {
			m[i] = (d[i - 1] - m[i - 1] / 2) * 2;
		}

		for (int i = 0; i < n; i++)
			out.print(m[i] + " ");
		out.flush();
	}

	static class FastReader {
		BufferedReader br;
		StringTokenizer st;

		public FastReader() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}

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

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

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

		double nextDouble() throws NumberFormatException, IOException {
			return Double.parseDouble(next());
		}

		String nextLine() throws IOException {
			String str = "";
			str = br.readLine();
			return str;
		}
	}

	static class con {
		static int IINF = (int) 1e9;
		static int _IINF = (int) -1e9;
		static long LINF = (long) 1e15;
		static long _LINF = (long) -1e15;
		static double EPS = 1e-9;
	}

	static class Triple implements Comparable<Triple> {
		int x;
		int y;
		int z;

		Triple(int x, int y, int z) {
			this.x = x;
			this.y = y;
			this.z = z;
		}

		@Override
		public int compareTo(Triple o) {
			if (x == o.x && y == o.y)
				return z - o.z;
			if (x == o.x)
				return y - o.y;
			return x - o.x;
		}
	}

	static class Pair implements Comparable<Pair> {
		int x;
		int y;

		Pair(int x, int y) {
			this.x = x;
			this.y = y;

		}

		@Override
		public int compareTo(Pair o) {
			if (x == o.x)
				return y - o.y;
			return x - o.x;
		}
	}

	static void shuffle(int[] a) {
		for (int i = 0; i < a.length; i++) {
			int r = i + (int) (Math.random() * (a.length - i));
			int tmp = a[r];
			a[r] = a[i];
			a[i] = tmp;
		}
	}

}

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

public class Program
{
    static int R, G, B, N;

    public static void Main(string[] args)
    {
        R = Input.NextInt();
        G = Input.NextInt();
        B = Input.NextInt();
        N = Input.NextInt();

        int p = 0;
        for (int r = 0; r <= N / R; r++)
        {
            int rn = N - r * R;
            for (int g = 0; g <= rn / G; g++)
            {
                int gn = rn - g * G;
                if (gn % B == 0)
                {
                    p++;
                }
            }
        }

        Console.WriteLine(p);
    }
}



public static class Input
{
    private static Queue<string> q = new Queue<string>();
    private static void Confirm() { if (q.Count == 0) foreach (var s in Console.ReadLine().Split(' ')) q.Enqueue(s); }
    public static int NextInt() { Confirm(); return int.Parse(q.Dequeue()); }
    public static long NextLong() { Confirm(); return long.Parse(q.Dequeue()); }
    public static string NextString() { Confirm(); return q.Dequeue(); }
    public static double NextDouble() { Confirm(); return double.Parse(q.Dequeue()); }
    public static int[] LineInt() { return Console.ReadLine().Split(' ').Select(int.Parse).ToArray(); }
    public static long[] LineLong() { return Console.ReadLine().Split(' ').Select(long.Parse).ToArray(); }
    public static string[] LineString() { return Console.ReadLine().Split(' ').ToArray(); }
    public static double[] LineDouble() { return Console.ReadLine().Split(' ').Select(double.Parse).ToArray(); }
}

Measured memory_bytes: 11220
#include <bits/stdc++.h>
using namespace std;
//何通りあるか答える,sは今いる場所,cは通った番号の総数
int N,M;
int A[10][10];
int rec(int s,int c){
	c = c|(1<<s) ;
	// printf("%d %d\n",s,c);
	// cout << static_cast<bitset<8> >(c) << endl;
	if(c == (1<<N)-1) return 1;
	int res = 0;
	for (int i = 0; i < N; ++i)
	{
		if(!((c>>i)&1) &&A[s][i]==1){
			res += rec(i,c);
		}
	}
	
	return res;
}
int main(){
	memset(A,0,sizeof(A));
	scanf("%d %d",&N,&M);
	for (int i = 0; i < M; ++i)
	{
		int s,e;
		scanf("%d %d",&s,&e);
		A[s-1][e-1]=1;
		A[e-1][s-1]=1;
	}
	printf("%d\n",rec(0,0));

}

Measured memory_bytes: 256
from itertools import combinations 

N = int(input())
L_list = sorted(list(map(int, input().split())))
ans = 0

for x, y, z in combinations(L_list, 3):
  #print(x, y, z)
  if x == y or y == z or z == x:
    continue
  if x + y > z and y + z > x and z + x > y:
    ans += 1

print(ans)

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

int main(){
	int n;
	cin>>n;
	string s[n];
	map<string,int> mp;
	rep(i,n){
		cin>>s[i];
		mp[s[i]]++;
	}
	int ma=0;
	for(auto p:mp)ma=max(ma,p.second);
	for(auto p:mp){
		if(p.second == ma)puts(p.first);
	}
}


Measured memory_bytes: 26752
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <complex>
using namespace std;
#define all(c) (c).begin(),(c).end()
#define pb push_back
#define mp make_pair
#define ERASE(v,i) (v).erase(remove(all(v),i),(v).end())
#define rep(i,n) for(int i=0;i<(int)n;++i)
#define each(it,c) for(typeof((c).begin()) it=(c).begin();it!=(c).end();++it)
#define debug(x) cerr<<#x<<" = "<<(x)<<endl;
#define LINE cerr<<"LINE: "<<__LINE__<<endl;
inline int toInt(string s){int v;istringstream i(s);i>>v;return v;}
template<class T> inline string toString(T x){ostringstream o;o<<x;return o.str();}
template<class T> void pv(T a,T b){for(T it=a;it!=b;++it)cerr<<*it<<" ";cerr<<endl;}
const int INF = 1000000000;
const double PI = acos(-1.0), EPS = 1e-10;

int main() {
	for(int N; cin >> N, N;) {
		vector<int> a(N);
		vector<int> s(5);
		rep(i,N) {
			rep(j,5) cin >> s[j];
			a[i] = accumulate(all(s),0);
		}
		cout << *max_element(all(a)) << " " << *min_element(all(a)) << endl;
	}
	return 0;
}

Measured memory_bytes: 0
/******************************************
* nils sjoberg never died  *
* He hibernated *
* So did dinesh easwar *
******************************************/
#include <iostream>
#include <bits/stdc++.h>
#include <string>
#include <cstdlib>
#include <iomanip>
 
using namespace std;
typedef vector< long long > vec;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
#define pb push_back
#define PB pop_back()
#define sqr(a) (((a) * (a)))
#define coud(a,b) cout<<fixed << setprecision((b)) << (a)
#define umap unordered_map
#define all(c) (c).begin(),(c).end()
#define newl "\n"
#define rep(i,a,b) for(ll i=a;i<b;i++)
#define rev(i,a,b) for(ll i=a; i>=b; i--)
#define forn(i, n) for (ll i = 0; i < n; i++)
#define sz(a) int((a).size())
#define frev(n) for(ll i=n-1; i>=0, i--)
#define tr(container, it) for(typeof(container.begin()) it = container.begin(); it != container.end(); it++)
#define present(container, element) (container.find(element) != container.end())
#define vecpresent(container, element) (find(all(container), element) != container.end())
#define N 1000000007
#define PI 3.1415926535897932384
#define F first
#define S second
#define FAST ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);

ll binpow(ll a, ll b, ll m){
	a %= m;
	ll res = 1;
	while(b>0){
	if(b&1)
		res = res * a % m;
	a = a * a % m;
	b >>= 1;
	}
	return res;
}

ll binmul(ll a, ll b, ll m){
	b %= m;
	ll res = 0;
	while(a>0){
		if(a&1)
			res = res + b % m;
		b = b + b % m;
		a >>= 1;
	}
	return res;
}

ll gcd(ll a, ll b){
	while(b){
		a %= b;
		swap(a, b);
	}
	return a;
}

pii fib(int n){
	if(n==0)
		return {0, 1};
	auto p = fib(n >> 1);
	int c = p.first * (2*p.second - p.first);
	int d = p.first*p.first + p.second*p.second;
	if(n&1)
		return {d, c+d};
	else
		return {c, d};
}


 
void solve(){
	ll l, r, d, cnt=0;
	cin >> l >> r >> d;
	for(int i=l; i<=r; i++){
		if(i%d==0) cnt++;
	}
	cout << cnt;	

	
}



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



Measured memory_bytes: 3652
#include <bits/stdc++.h>
#define rep(i,m,n) for(int i=m;i<n;i++)
#define fix(n) cout<<fixed<<setprecision(n)
#define co(n) cout<<n<<endl
#define all(n) (n).begin(),(n).end()
using namespace std;
typedef long long ll;
const ll mod=1000000007;
double pi=3.1415926535;

int main(){
  string s,t,s1="",s2="";
  int q,a,b;
  cin>>s>>q;
  int c=0;
  rep(i,0,q){
    cin>>a;
    if(a==1) c++;
    else{
      cin>>b>>t;
      if(c%2==0 && b==1) s1+=t;
      else if(c%2==0 && b==2) s2+=t;
      else if(c%2==1 && b==1) s2+=t;
      else s1+=t;
    }
  }
  if(c%2==1){
    reverse(all(s));
    reverse(all(s2));
    s2+=s;
    s2+=s1;
    co(s2);
  }
  else{
    reverse(all(s1));
    s1+=s;
    s1+=s2;
    co(s1);
  }
  
  return 0;
}

Measured memory_bytes: 1348
#include <stdio.h>

int main()
{
	int n,g[100005],cnt=0,i;
	scanf("%d",&n);
	for(i=1;i<=n;i++) scanf("%d",&g[i]);
	for(i=1;i<=n;i++)
	{
		if(g[g[i]]==i) cnt++;
		g[i]=0;
	}
	printf("%d",cnt);
}

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

#define PI 3.14159265359
using namespace std;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define bit(n,k) (((ll)n>>(ll)k)&1) /*nのk bit目*/
#define pb push_back
#define eb emplace_back
#define SZ(x) ((ll)(x).size())
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
const long long INF= 1e+18+1;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll> >vvl;
typedef pair<ll,ll> P;
typedef tuple<ll,ll,ll> T;
const ll MOD=1000000007LL;
//ll MOD=1000000007LL;
//const ll MOD=998244353LL;
//const ll MOD=1777777777LL;
//const ll MAX_V=114514LL;
//const ll MAX = 500010LL;
const ll mod=MOD;
string abc="abcdefghijklmnopqrstuvwxyz";
string ABC="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
vl dx={0,0,1,-1};
vl dy={1,-1,0,0};

//素因数分解O(√n)
map<ll,ll>prime_factor(ll n){
  map<ll,ll>res;
  for(ll i=2;i*i<=n;i++){
    while(n%i==0){
      res[i]++;
      n/=i;
    }
  }
  if(n!=1)res[n]=1;
  return res;
}

const ll MAX = 510000;
long long fac[MAX], finv[MAX], inv[MAX];
//finvが階乗の逆元

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (ll i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(ll n, ll k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

ll modpow(ll a, ll n, ll mod) {
  
    ll res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}



int main(){
  ios::sync_with_stdio(false);
  std::cin.tie(nullptr);
  cout << fixed << setprecision(10);
  /*--------------------------------*/
  ll a,b,c,d;cin>>a>>b>>c>>d;
  if(a+b==c+d)cout<<"Balanced"<<endl;
  else if(a+b>c+d)cout<<"Left"<<endl;
  else cout<<"Right"<<endl;
}

Measured memory_bytes: 3628
#include <cstdio>
#include <cstring>
#include <cmath>
#include <vector>
#include <iostream>
#include <iomanip> 
#include <algorithm>
#include <queue>
#include <list>
#include <numeric>
#include <stack>
#include <unordered_map>
#include <map>
#include <set>
 
using namespace std;
 
#define sz(a) int((a).size())
#define all(x) x.begin(), x.end()
#define pb push_back
#define endl '\n'
#define watch(x) cout << #x << " : " << x << endl;
 
#define FastIO ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
 
typedef long long ll;
typedef vector< int > vi;
typedef vector< vi > vvi;
typedef pair< int,int > ii;
typedef vector<ii> vii;
 
const int N = int(2e5)+10;
const int K = 10005;
// const int MOD = int(1e9)+7;
const int INF = int(1e9)+5;
const ll INF64 = 1e18;

const ll MOD = 998244353;
inline ll add(ll a, ll b, ll m) { return (((a % m + b % m) % m + m) % m); }
inline ll mul(ll a, ll b, ll m) { return (((a % m * b % m) % m + m) % m); }

ll inv[N],fact[N],ifact[N];

//! Modular Exponentiation.
ll modpow (ll x,ll n) {
    if (n == 0ll) return 1ll;
    ll u = modpow(x,n/2);
    u = mul(u,u,MOD);
    if (n % 2 == 1) u = mul(u,x,MOD);
    return u;
}

void pre () {
    inv[1] = fact[0] = fact[1] = ifact[0] = ifact[1] = 1;
    for (int i=2;i<N;i++) {
        inv[i] = mul(MOD - MOD / i, inv[MOD % i], MOD);
        fact[i] = mul(i * 1ll, fact[i - 1], MOD);
        ifact[i] = mul(inv[i], ifact[i - 1], MOD);
    }
    return;
}

ll nCr (ll n,ll r) {
    if (n >= 0 && r >= 0 && n >= r) {
        return mul(fact[n],mul(ifact[r],ifact[n-r],MOD),MOD);
    }
    return 0;
}

void solve () {
    pre();
    ll n,m,k;cin>>n>>m>>k;
    ll ans = 0;
    // k1 are same as left.
    for (int k1=0;k1<=k;k1++) {
        // n-1Ck1 * m * (m-1) ^ (n-1-k1).
        ll temp = nCr(n-1,k1);
        temp = mul(temp,m,MOD);
        temp = mul(temp,modpow(m-1,n-1-k1),MOD);
        ans = add(ans,temp,MOD);
    }
    cout<<ans<<endl;
}

int main () {
    FastIO
// #ifndef ONLINE_JUDGE
//     freopen("input.txt", "r", stdin);
//     freopen("output.txt", "w", stdout);
// #endif
    int t;
    // cin>>t;
    t = 1;
    while (t--) {
        solve();
    }
    return 0;
}

Measured memory_bytes: 8296
/*
Roses are red
Memes are neat
All my test cases time out
Lmao yeet
*/
import java.util.*;
import java.io.*;

   public class Main
   {
      public static void main(String args[]) throws Exception
      {
         BufferedReader infile = new BufferedReader(new InputStreamReader(System.in));  
         StringTokenizer st = new StringTokenizer(infile.readLine());
         int N = Integer.parseInt(st.nextToken());
         st = new StringTokenizer(infile.readLine());
         int[] arr = new int[N];
         for(int i=0; i < N; i++)
            arr[i] = Integer.parseInt(st.nextToken());
         //brute force
         if(sort(arr))
         {
            System.out.println("YES");
            return;
         }
         for(int a=0; a < N; a++)
            for(int b=a+1; b < N; b++)
            {
               int[] temp = new int[N];
               for(int i=0; i < N; i++)
                  temp[i] = arr[i];
               temp[a] = arr[b];
               temp[b] = arr[a];
               if(sort(temp))
               {
                  System.out.println("YES");
                  return;
               }
            }
         System.out.println("NO");
      }
      public static boolean sort(int[] arr)
      {
         for(int i=0; i < arr.length; i++)
            if(arr[i] != i+1)
               return false;
         return true;
      }
   }

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

bool dfs(int n, int a) {
  if (n == a) return true;
  if (n < a) return false;

  bool res1 = dfs(n, a + 4);
  bool res2 = dfs(n, a + 7);

  return res1 | res2;
}

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

  if (dfs(n, 0)) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}

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

#define ed cout<<"\n";
#define speed ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define ll long long 
#define ffor(i,a,b) for(ll i=(ll)(a);i<(ll)(b);++i)
#define rep(i, n) ffor(i,0,n)
#define All(obj) (obj).begin(),(obj).end()
#define INF ((ll)1e9+7)
#define c(a) cout<<a<<"\n";
using namespace std;
const int N = 100005;



int main() {
	speed;
	cout << fixed << setprecision(14);
	int n;
	cin >> n;
	vector<double>a(n);
	rep(i, n) {
		cin >> a[i];
	}
	double sum = 0;
	rep(i, n) {
		sum+= 1 / a[i];
	}
	sum = 1 / sum;
	cout << sum;
	ed;
	return 0;
}


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

int gcd(int a,int b,int c){
  int g;
  if(a == b && b == c){
    return a;
  }
  
  int min;
  
  if(a < b){
    min = a;
  }
  else{
    min = b;
  }
  if(min > c){
    min = c;
  }
  
  for(int i = min; i > 0 ; i--){
    if(a%i == 0 && b%i == 0){
      if(c%i == 0){
        g = i;
        break;
      }
    }
  }
  return g;
}

int main(){
  int K;
 
  cin >> K;
  int i, j, k;
  int sum=0;
  for(i=0; i<K; i++){
      for(j=0; j<K; j++){
        for(k=0; k<K; k++){
    	  sum += gcd(i+1, j+1, k+1);
          //cout << sum << endl;
      }
    }
  }
  cout << sum << endl;
}

Measured memory_bytes: 3640
#include<bits/stdc++.h>
using namespace std;
#define optimize() ios_base:: sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define endl '\n'

int main()
{
    optimize ();
    int a[3],d1,d2,c=0;

    for(int i=0;i<3;i++){
        cin>>a[i];
        if(a[i]==5 || a[i]==7){
            continue;
        }
        else{
        c=1;
        cout<<"NO"<<endl;
        break;
        }
    }
if(c==0){
    sort(a,a+3);
    d1=a[0]-a[1];
    d2=a[2]-a[1];
    if(d1==0 && d2==2 ){
        cout<<"YES"<<endl;
    }
    else {
        cout<<"NO"<<endl;
    }
    }
    return 0;
}



Measured memory_bytes: 3596
//! 尺卂乃卂.卂ﾌ乇乇ㄒ
#include<bits/stdc++.h>
//#include <ext/pb_ds/detail/standard_policies.hpp>
using namespace std;
//Using namespace __gnu_pbds;
//typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> Ordered_set;

#define ll              long long
#define int             long long
#define ld             long double
#define pb              push_back
#define pii             pair<int,int>
#define vi              vector<int>
#define vii             vector<vi>
#define vip            vector<pii>
#define mii             map<int,int>
#define mip             map<pair<int,int>,int>
#define mic             map<char,int> 
#define all(v)          v.begin(),v.end()  
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define lb(x)           (x&(-x))
#define mod             1000000007
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define w(x)            int x; cin>>x; while(x--)
#define itr(it,v)          for(auto it:v)
#define show(arr,n)     for(int i=0;i<n;i++) cout<<arr[i]<<" "; cout<<"\n";
#define fi(i,n)         for(int i=0;i<n;i++)
#define fir(i,k,n)       for(int i=k;k<n?i<n:i>n;k<n?i+=1:i-=1)
#define ff               first 
#define ss               second
#define deb(x) cout << #x << "=" << x << endl
#define FIO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define check(x) (x && cout<<"Yes\n")||(cout<<"No\n");
#define fin(s)          freopen(s,"r",stdin);  
#define fout(s)         freopen(s,"w",stdout);

const ld pi = 3.141592653589793238462643383279502884;
const int xd[]={-1,0,1,0};
const int yd[]={0,-1,0,1};
int XX[] = { -1, -1, -1, 0, 0, 1, 1, 1 };
int YY[] = { -1, 0,  1, -1, 1, -1, 0, 1 };

int expo(int a,int b,int m);
int mmi(int a,int m);
void ipgraph(int m);

const int N=5*(1e5)+10;
vii adj(N);
int a[N];

void  solve(){

}
int32_t main()
{
    FIO
    int n,k; cin>>n>>k;
    fi(i,n) cin>>a[i];
    sort(a,a+n);
    int dp[k+1]={1};
    fi(i,k+1) dp[i]=1;
    dp[0]=0;
    fir(i,1,k+1){
        int c=1;
        fi(j,n){
            if(i-a[j]>=0) c=dp[i-a[j]]; 
            else break;
            if(c==0) break;
        }
        // if(c==0)
        dp[i]=1-c;
    }
    if(dp[k]) cout<<"First\n";
    else cout<<"Second\n";
    return 0;

}

void ipgraph(int m){
    int i, u, v;
    while(m--){
          cin>>u>>v;
         u--, v--;
    adj[u].pb(v);
    adj[v].pb(u);
    }
}
int expo(int a,int b,int m){
    if(b==0) return 1;
    if(b==1) return a;
    int val=(expo(a,b/2,m)*expo(a,b/2,m))%m;
    if(b & 1) return (val*a)%m;
    else return val;
}
int mmi(int a,int m){
    return expo(a,m-2,m);
}

Measured memory_bytes: 12800
# https://atcoder.jp/contests/abc118/tasks/abc118_c

n = int(input())
A = [int(i) for i in input().split()]

ans = A[0]
for a in A[1:]:
    if ans > a:
        ans, a = a, ans  # ansが常に小さくなるようにする。
    while a % ans != 0:
        a = a % ans
        a, ans = ans, a
    if ans == 1:
        print(1)
        quit()

print(ans)


Measured memory_bytes: 85428
#include <iostream>
#include <string>
#include <vector>
#include <stdlib.h>
#include <cstdint>
#include <cmath>
#include <algorithm>
#include <float.h>
using namespace std;

#define N 100
#define M N

string blue[N];
string red[M];

typedef pair<string, int> P;

vector<P> vec;
vector<P>::iterator it;

bool pairComp(const P& l, const P& r)
{
    return l.second > r.second;
}

struct comp {
    comp(string const& s) : _s(s) { }

    bool operator () (P const& p)
    {
        return (p.first == _s);
    }

    string _s;
};

int main()
{
	int n, m;
	int ans;
	
	cin >> n;
	for( int i = 0; i < n; i++ ) {
		cin >> blue[i];
	}
	cin >> m;
	for( int i = 0; i < m; i++ ) {
		cin >> red[i];
	}

	for( int i = 0; i < n; i++ ) {
		it = find_if( vec.begin(), vec.end(), comp(blue[i]) );
		if( it != vec.end() ) {
			it->second++;
		}
		else {
			vec.push_back( P(blue[i], 1) );
		}
	}

	for( int i = 0; i < m; i++ ) {
		it = find_if( vec.begin(), vec.end(), comp(red[i]) );
		if( it != vec.end() ) {
			it->second--;
		}
		else {
			vec.push_back( P(red[i], -1) );
		}
	}

	sort( vec.begin(), vec.end(), pairComp );
	it = vec.begin();
	ans = max( (*it).second, 0);

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<algorithm>
int main(){
	int a[5]={};
	int b[5]={};
	int ans=0;
	for(int i=0;i<5;i++){
		scanf("%d",&a[i]);
		if(a[i]%10==0)ans+=a[i];
		else ans+=( (a[i]/10)*10+10 );
		b[i]=a[i]%10;
		if(b[i]==0)b[i]=100;
	}
	std::sort(b, b+5);
	if(b[0]!=100){
		ans=ans-10+b[0];
	}
	printf("%d\n",ans);
	return 0;
}

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

using namespace std;

int main() {
  string s;
  cin >> s;
  map<string, int> m;
  m["SUN"] = 0;
  m["MON"] = 1;
  m["TUE"] = 2;
  m["WED"] = 3;
  m["THU"] = 4;
  m["FRI"] = 5;
  m["SAT"] = 6;
  cout << 7 - m[s] << endl;
  return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll n,dist,ans;
int main()
{
	cin>>n>>dist;
	ll x[n+5],y[n+5];
	for(ll i=1;i<=n;i++)
	{
		cin>>x[i]>>y[i];
		ll d=x[i]*x[i]+y[i]*y[i];
		if(d<=dist*dist) ans++;
	}
	
    
    cout<<ans;
    return 0;
}

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

int main(){

    int n,y;
    scanf("%d", &n);
    scanf("%d", &y);
    int n1 = -1;
    int n2 = -1;
    int n3 = -1;
    bool flag = false;

    for(int i = 0; i <= n; i++){
        for(int j = 0; j <= n - i; j++){
            if((10000 * i + 5000 * j + 1000 * (n-i-j)) == y){
                flag = true;
                n1 = i;
                n2 = j;
                n3 = n - i - j;
                break;
            }
        }
        if(flag){
            break;
        }
    }
    printf("%d %d %d",n1,n2,n3);

    return 0;
}

Measured memory_bytes: 256
import sys
def LI(): return list(map(int, sys.stdin.buffer.readline().split()))
def I(): return int(sys.stdin.buffer.readline())
def LS(): return sys.stdin.buffer.readline().rstrip().decode('utf-8').split()
def S(): return sys.stdin.buffer.readline().rstrip().decode('utf-8')
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
def SRL(n): return [list(S()) for i in range(n)]
def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]
mod = 10 ** 9 ** 2


a, b, c, d = LI()

x = [a, b]
y = [c, d]
xy = -mod

for i in range(2):
    for j in range(2):
        buf = x[i] * y[j]
        # print(buf)
        if xy < buf:
            xy = buf
print(xy)

Measured memory_bytes: 9308
#include<bits/stdc++.h>
#define lld long long int
#define vec vector<lld>
#define pll pair<lld,lld>
#define pb push_back
#define ss second
#define ff first
#define mp make_pair
#define mod 998244353
#define answer(x) cout<<endl<<"answer : "<<x<<endl<<endl;
#define op(x) cout<<x<<endl;
#define maxn 500005
#define lld_max 5000000000000000000
#define messi ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
using namespace std;
int main() {messi lld t=1;//cin>>t;
    while(t--)
    {
        lld n=0,m=0,k=0,i=0,j=0,p=0,q=0,x=0,y=0,z=0,ans=0,cnt=0,l=0,r=0,mid=0,lo=0,hi=0;string s;bool flag=false;
        cin>>n>>k;
        pll seg[k];
        for(i=0;i<k;i++)
            cin>>seg[i].ff>>seg[i].ss;
        lld dp[n+1];
        lld dp2[n+1];
        memset(dp,0,sizeof(dp));
        memset(dp2,0,sizeof(dp));
        dp[0]=0, dp2[0]=0;
        dp[1]=1, dp2[1]=1;
        for(i=2;i<=n;i++)
        {
            cnt = 0;
            for(j=0;j<k;j++)
            {
                x = seg[j].ff;
                y = min(i-1, seg[j].ss) ;
                if(x<i)
                {
                    cnt = (cnt + dp2[i-x])%mod;
                    cnt = (cnt - dp2[(i-y) - 1])%mod;
                    if(cnt<0)
                        cnt+=mod;
                }
            }
            dp[i] = cnt%mod;
            dp2[i] = (dp2[i-1]%mod + cnt%mod)%mod;
        }
        op(dp[n]);
    }
	return 0;
}
/*  CODED BY:-
 ________________________________________
|            __        __                |
|  /\   /\  |__)  /\  |  \ |__| \ /  /\  |
| /~~\ /~~\ |  \ /~~\ |__/ |  |  |  /~~\ |
|________________________________________|

*/


Measured memory_bytes: 6784
#pragma region
#include <algorithm>
#include <cstring>
#include <iostream>
#include <map>
#include <queue>
#include <stack>
#include <string>
#include <vector>
typedef long long ll;
#define tr t[root]
#define lson t[root << 1]
#define rson t[root << 1 | 1]
#define rep(i, a, n) for (long long i = a; i <= n; ++i)
#define per(i, a, n) for (long long i = n; i >= a; --i)
#define IO ios::sync_with_stdio(false), cin.tie(0), cout.tie(0)
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;
}
using namespace std;
/*
 *                                                     __----~~~~~~~~~~~------___
 *                                    .  .   ~~//====......          __--~ ~~
 *                    -.            \_|//     |||\\  ~~~~~~::::... /~
 *                 ___-==_       _-~o~  \/    |||  \\            _/~~-
 *         __---~~~.==~||\=_    -_--~/_-~|-   |\\   \\        _/~
 *     _-~~     .=~    |  \\-_    '-~7  /-   /  ||    \      /
 *   .~       .~       |   \\ -_    /  /-   /   ||      \   /
 *  /  ____  /         |     \\ ~-_/  /|- _/   .||       \ /
 *  |~~    ~~|--~~~~--_ \     ~==-/   | \~--===~~        .\
 *           '         ~-|      /|    |-~\~~       __--~~
 *                       |-~~-_/ |    |   ~\_   _-~            /\
 *                            /  \     \__   \/~                \__
 *                        _--~ _/ | .-~~____--~-/                  ~~==.
 *                       ((->/~   '.|||' -_|    ~~-/ ,              . _||
 *                                  -_     ~\      ~~---l__i__i__i--~~_/
 *                                  _-~-__   ~)  \--______________--~~
 *                                //.-~~~-~_--~- |-------~~~~~~~~
 *                                       //.-~~~--\
 *                       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 */

#pragma endregion
const int maxn = 1e3 + 5;
const ll mod = 1e9 + 7;
ll n, m, dp[maxn][maxn];
char maze[maxn][maxn];
int main() {
    IO;
    cin >> n >> m;
    rep(i, 1, n) cin >> (maze[i] + 1);
    dp[1][1] = 1;
    rep(i, 1, n) rep(j, 1, m) {
        if (maze[i][j] == '#') continue;
        if (j - 1 >= 1 && maze[i][j - 1] - '#') dp[i][j] = (dp[i][j] + dp[i][j - 1]) % mod;
        if (i - 1 >= 1 && maze[i - 1][j] - '#') dp[i][j] = (dp[i][j] + dp[i - 1][j]) % mod;
    }
    cout << dp[n][m] << endl;
}

Measured memory_bytes: 11944
#include <iostream>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <queue>
#include <vector>
#include <algorithm>
#include <map>

int main(){
  std::string s1, s2;
  std::cin >> s1;
  std::cin >> s2;
  int map[s1.length()+5][s2.length()+5];
  for (int j=0; j<=s2.length(); j++){
    map[0][j]=j;
  }

  // 斜め
  int counter = 0;
  while(counter<=s1.length()+s2.length()){
    for (int k=0; k<=counter; k++){
      int i=k;
      int j=counter-k;
      if (i>s1.length() || j>s2.length()){
        continue;
      }
      if (i==0 && j==0){
        map[i][j] = 0;
      } else if (i==0){
        map[i][j] = j;
      } else if (j==0){
        map[i][j] = i;
      } else {
        int add = (s1[i-1]==s2[j-1])?0:1;
        map[i][j] = std::min(map[i-1][j-1]+add, std::min(map[i-1][j]+1, map[i][j-1]+1));
      }
    }
    counter++;
  }

  /*for (int i=0; i<=s1.length(); i++){
    for (int j=0; j<=s2.length(); j++){
      printf("map[%d][%d]=%d\n",i,j,map[i][j]);
    }
    }*/
    

  std::cout << map[s1.length()][s2.length()] << std::endl;
  return 0;
}



Measured memory_bytes: 7112
import java.util.Scanner;

/**
 *
 * @author lenovo
 */
public class Main {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        // TODO code application logic here
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int A = sc.nextInt();
        System.out.println(N*N-A);
    }
    
}


Measured memory_bytes: 25556
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
 
ll calc_sadness(ll a[], ll n, ll b){
    ll dist = 0;
    ll i = 1;
 
    for(int i = 0; i < n; ++i){
        dist += abs(a[i] - (b + i + 1));
    }
    return dist;
}
 
int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
 
    ll n;
    cin >> n;
    ll a[n];
 
    rep(i, n) cin >> a[i];
 
    ll l = -1e9;
    ll r = 1e9;
    ll res = 1e20;
 
    while(abs(l-r)>2){
        ll m1 = (2*l + r) / 3;
        ll m2 = (l + 2*r) / 3;
 
        ll dist1 = calc_sadness(a, n, m1);
        ll dist2 = calc_sadness(a, n, m2);
 
        res = min(res, min(dist1, dist2));
 
        if(dist1 <= dist2){
            r = m2;
        }
        else{
            l = m1;
        }
    }
 
 
    cout << res << endl;
 
 
}

Measured memory_bytes: 1792