akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
const int MAXN = 1e5+11,N=305;
int memo[MAXN];
int K;
void add_self(int &a,int b){
    a += b;
    if(a >= mod)
        a-=mod;
}

void sub_self(int &a,int b)
{
    a -= b;
    if(a < 0)
        a+=mod;
}

int distribute(int *c,int pos,int n,int k){
    int ways;
    if(k==0)
        return ways = 1;
    if(pos == n)
        return ways = 0;
    ways = 0;
    for(int cap = 0;cap<=c[pos] && k >= cap;cap++){
        add_self(ways,distribute(c,pos+1,n,k-cap));
    }
    return ways;
}


int main(){
    memset(memo,-1,sizeof memo);
    int n,k;
    K =k ;
    scanf("%d%d",&n,&k);
    int candies[n];
    for(int i= 0;i<n;i++)
        scanf("%d",&candies[i]);
   
    vector<int> dp(k+1,0);
    
    dp[0] = 1;//number of ways to distribute 0 candies among n children
  
    for(int c : candies){
        vector<int> dp2(k+1,0);
        for(int used = k;used >= 0;--used)
        {
            int temp  = dp[used];
            int L = used + 1;
            int R = used + min(c,k-used);
            if(L <= R)
            {
                add_self(dp2[L],temp);
                if(R+1 <= k)
                  sub_self(dp2[R+1],temp);
            }
            /*
            for(int here = 1;here <= min(c , k - used);here++)
            {
                add_self(dp[used + here],dp[used]);
            }
            */
        }
        
        for(int i = 0;i<=k;i++)
        {
            if(i)
            add_self(dp2[i],dp2[i-1]);
            add_self(dp[i],dp2[i]);
        }
    }
    
    printf("%d\n",dp[k]);
    
    return 0;
}

Measured memory_bytes: 1408
#include <iostream>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <queue>
#include <stack>
#include <vector>
#include <algorithm>
#include <map>
#include <unordered_map>
#include <set>
#include <deque>
#include <bitset>

long long mod = 1e9+7;
class Mint {
public:
  long long x;
  Mint(){}; // 引数なしでも定義できるように引数なしコンストラクタも用意しておく
  Mint(long long a){
    x = a%mod;
    while(x<0){
      x += mod;
    }
  };
  Mint& operator += (const Mint &a){
    x+=a.x;
    x%=mod;
    return *this;
  }
  Mint& operator -= (const Mint &a){
    x += (mod - a.x);
    x%=mod;
    return *this;
  }
  Mint& operator *= (const Mint &a){
    x*=a.x;
    x%=mod;
    return *this;
  }

  // a^n mod を計算する
  // Useaeg: Mint z = Mint(2).pow(n);
  Mint pow(long long n) const {
    if (n==0) return Mint(1);
    Mint y = pow(n>>1); // pow(n/2)を計算する
    y *= y;
    if (n%2==1) y *= *this;
    return y;
  }

  // a^{-1} mod を計算する
  Mint modinv(const Mint &a) const {
    return a.pow(mod-2);
  }

  Mint& operator /= (const Mint &a) {
    x *= modinv(a).x;
    x %= mod;
    return *this;
  }

  Mint operator + (Mint &a) const {
    Mint y(*this);
    y += a;
    return y;
  }

  Mint operator - (Mint &a) const {
    Mint y(*this);
    y -= a;
    return y;
  }

  Mint operator * (Mint &a) const {
    Mint y(*this);
    y *= a;
    return y;
  }

  Mint operator / (Mint &a) const {
    Mint y(*this);
    y/=a;
    return y.x;
  }

  // nCk @mod を計算する
  Mint nCk(Mint &n, const long long k) const {
    Mint y = Mint(1);
    Mint one = Mint(1);
    for (Mint i(0); (i.x)<k; i.x++){
      y *= (n-i);
      y /= (i + one);
    }
    return y;
  }

  // nPk @mod を計算する
  Mint nPk(Mint &n, long long k) const {
    Mint y(1);
    for (Mint i(0); (i.x)<k; i.x++){
      y *= (n-i);
    }
    return y;
  }
};

int main() {
  std::string s;
  std::cin >> s;
  int n = s.length();
  std::vector<int > dp(n+4);
  for (int i=0; i<n; i++) {
    if (s[i]=='1') dp[i+1] = 1;
    else dp[i+1] = 0;
  }
  bool ok = true;
  for (int i=1; i<n; i++) {
    // printf("%d == %d\n", dp[i], dp[n-i]);
    if (dp[i]!=dp[n-i]) {
      ok = false;
      break;
    }
  }
  //std::cout << ok << std::endl;
  if (dp[n]!=0) ok = false;
  if (dp[1]!=1) ok = false;
  if (!ok) {
    printf("-1\n");
    return 0;
  }
  std::vector<std::pair<int, int> > edge;
  edge.push_back(std::make_pair(1, 2));
  int target = 2;
  int v = 3;
  for (int i=2; i<n; i++) {
    edge.push_back(std::make_pair(target, v));
    v++;
    if (dp[i]==1) target = v - 1;
  }
  for (auto &entry : edge) {
    std::cout << entry.first << " " << entry.second << std::endl;
  }
  return 0;
}

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

// #define int long long
#define sync ios::sync_with_stdio(0), cin.tie(0), cout.tie(0)
#define file freopen("input.txt", "r", stdin), freopen("output.txt", "w", stdout)
#define endl "\n"
#define ends " "
#define die(x) return cout << x << endl, 0
#define all(v) v.begin(), v.end()
#define debug(x) cerr << #x << ": " << x << endl
#define debugP(p) cerr << #p << ": {" << p.first << ", " << p.second << '}' << endl
#define debugV(v) cerr << #v << ": [ "; for(int __ = 0; __ < v.size(); __++) cerr << v[__] << ((__ != v.size() - 1) ? ", " : ends); cerr << ']' << endl
#define debugVP(v) cerr << #v << ": [ "; for(int ___ = 0; ___ < v.size(); ___++) cerr << '{' << v[___].first << ", " << v[___].second << '}' << ((___ != v.size() - 1) ? ", " : ends); cerr << ']' << endl
#define debugA(a, n) cerr << #a << ": [ "; for(int ____ = 0; ____ < n; ____++) cerr << a[____] << ((____ != n - 1) ? ", " : ends); cerr << ']' << endl
#define print(args...) fprintf (stderr, args)
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef vector<pii> vpii;
const int INF = 1e9, MOD = INF + 7 /* INF - 1755647 */;

/////////////////////////////////////////////////////////////////////

const int N = 3e5 + 20;

int ps[N];

int32_t main() {

    sync;

    int n; cin >> n;
    string s; cin >> s;

    for(int i = 1; i <= n; i++) ps[i] = ps[i - 1] + (s[i - 1] == '#');

    int ans = INF;
    for(int i = 0; i <= n; i++) {
        ans = min(ans, 2 * ps[i] + n - i - ps[n]);
    }

    cout << ans << endl;

    return 0;
}


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

int main() {
    int h,w,d;
    cin >> h >> w >> d;

    int maxv = h * w;
    vector<pair<int,int>> a(maxv + 10);
    for (int i = 0; i < h; i++) {
        for (int j = 0; j < w; j++) {
            int v;
            cin >> v;
            a[v].first = i;
            a[v].second = j;
        }
    }

    vector<vector<int>> dist(d + 1);
    for (int i = 1; i <= d; i++) {
        int cur = i;
        dist[cur % d].push_back(0);
        int sum = 0;
        while(true) {
            cur += d;
            if(cur > maxv) break;
            int curx = a[cur].first;
            int posx = a[cur - d].first;
            int cury = a[cur].second;
            int posy = a[cur - d].second;

            int len = abs(curx - posx) + abs(cury - posy);
            sum += len;
            dist[cur % d].push_back(sum);
        }
    }

    int q;
    cin >> q;
    while(q--) {
        int s,g;
        cin >> s >> g;

        int m = g % d;
        int sitr = (s - m) / d;
        int gitr = (g - m) / d;
        if(m == 0) sitr--, gitr--;
        cout << dist[m][gitr] - dist[m][sitr] << endl;
    }

}

Measured memory_bytes: 6016
n, m = map(int, input().split())
A = list(map(int, input().split()))

A.sort()
A.reverse()
s = 0
cnt = 0

for i in range(n):
    s += A[i]
    
for i in range(m):
    if A[i] >= s/(4*m):
        cnt += 1

if cnt == m:
    print('Yes')
else :
    print('No')


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

const int MAXW = 1e5 + 10, MAXN = 1e3 + 10;

int n, m, wgh[MAXN], val[MAXN], ans;

ll f[MAXW]; // 达到价值 i 所用做小重量

int main() {
    scanf("%d %d", &n, &m);
    for (int i = 1; i <= n; ++i) scanf("%d %d", &val[i], &wgh[i]);
    memset(f, 0x3f, sizeof f);
    f[0] = 0;
    for (int i = 1; i <= n; ++i) {
        for (int j = MAXW - 1; j >= wgh[i]; --j) {
            f[j] = min(f[j], f[j - wgh[i]] + val[i]);
            if (f[j] <= m) ans = max(ans, j);
        }
    }
    printf("%d\n", ans);
    return 0;
}

Measured memory_bytes: 1152
import heapq

n, m = map(int, input().split())
A = list(map(lambda x: -int(x), input().split()))

heapq.heapify(A)
for i in range(m):
    item = heapq.heappop(A)
    heapq.heappush(A, (-1) * (-item // 2))

print(-sum(A))

Measured memory_bytes: 20392
#include <bits/stdc++.h>
#define ll long long int
using namespace std;
int main() {
    ll a,b,c,x,y;
    cin >> a >> b >> c >> x >> y;
    ll count1,count2,count3;
    ll rem = max(x,y);
    count1 = 2 * rem * c;
    ll rem1 = min(x,y);
    ll chosen = (rem1 == x) ? 0 : 1;
    if (chosen == 0) {
        count2 = 2 * rem1 * c;
        ll diff = y - x;
        count2 += diff * b;
    } else {
        count2 = 2 * rem1 * c;
        ll diff = x - y;
        count2 += diff * a;
    }
    count3 = x * a + y * b;
    cout << min(count1,min(count2,count3)) << "\n";
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define repl(i, l, r) for (int i = l; i < r; ++i)
#define rep(i, n) repl(i, 0, n)
#define pb push_back
#define eb emplace_back
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define chmax(x,y) x = max(x, y)
#define chmin(x,y) x = min(x, y)
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;
using G = vector<vector<int>>;
const int MOD = 1000000007;
const int INF = 1001001001;
const ll LINF = 1001001001001001001;
const int dy[] = {-1, 0, 1, 0};
const int dx[] = {0, -1, 0, 1};

int main()
{
    int n;
    cin >> n;
    vector<int> c(n), s(n), f(n);
    rep(i, n-1) cin >> c[i] >> s[i] >> f[i];
    rep(i, n) {
        int t = 0;
        repl(j, i, n-1) {
            if(t < s[j]) t = s[j];
            else if(t % f[j] == 0);
            else t = t + f[j] - t % f[j];
            t += c[j];
        }
        cout << t << endl;
    }
    return 0;
}


Measured memory_bytes: 3608
func readInts() -> [Int] {
    return readLine()!.split(separator: " ").map { Int($0)! }
}
    
let ab = readInts()
let a = ab[0]
let b = ab[1]
if a-2*b>0{
  print(a-2*b)
}else{
  print(0)
}

Measured memory_bytes: 8292
// "C"で区切る累積和
package main
import "fmt"
func main(){
	var N, Q int
	var S string
	fmt.Scan(&N, &Q, &S)
	T := make([]string, N)
	for i, c := range []rune(S){
		T[i] = string(c)
	}
	Ruiseki := make([]int, N+1)
	for i:=1; i<N; i++{
		Ruiseki[i+1] = Ruiseki[i]
		if T[i-1] == "A" && T[i] == "C"{
			Ruiseki[i+1]++
		}
	}
	for i:=0; i<Q; i++{
		var L, R int
		fmt.Scan(&L, &R)
		fmt.Println(Ruiseki[R]-Ruiseki[L])
	}
}

Measured memory_bytes: 6396
#include <cstdio>
#include <iostream>
#include <cstring>
#include <math.h>
#include <bits/stdc++.h>
using namespace std;
int a[55556];
int b[]={7, 17, 37, 47, 67, 97, 107, 127, 137, 157, 167, 197, 227, 257, 277, 307, 317, 337, 347, 367, 397, 457, 467, 487, 547, 557, 577, 587, 607, 617, 647, 677, 727, 757, 787, 797, 827, 857, 877, 887, 907, 937, 947, 967, 977, 997, 1087, 1097, 1117, 1187, 1217, 1237, 1277, 1297, 1307, 1327, 1367, 1427, 1447, 1487, 1567, 1597, 1607, 1627, 1637, 1657, 1667, 1697, 1747, 1777, 1787, 1847, 1867, 1877, 1907, 1987, 1997
};

int main()
{
    int n;
    cin>>n;
       int sum = 0;
        int tag = 0;
        int i ;
        cout<<"7";
        int f = 1;
        while(1)
        {
            if(b[f])
            {
                tag++;
                f++;
                cout<<" "<<b[f];
            }
            if(tag == (n-1))break;
        }
        cout<<endl;

    return 0;
}


Measured memory_bytes: 256
// This is the start of shubhams template//
#include<bits/stdc++.h>
using namespace std;
#define endl "\n"
#define int long long int
void input(){
#ifndef ONLINE_JUDGE
freopen("input.txt","r",stdin);
freopen("output.txt","w",stdout);
#endif
}
#define deg(x) cout<<#x<<" = "<<x;
#define vll vector<int>
#define pb push_back
#define pll pair<int,int>
#define mp(a,b) make_pair(a,b)
#define ff first
#define ss second
#define INF LONG_LONG_MAX
#define mod 1000000007
#define all(x) x.begin(),x.end()
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define cases int t; cin>>t; while(t--)
#define array(a,n) vll a(n); rep(i,0,n) cin>>a[i];
#define sortall(a) sort(a.begin(),a.end())
#define printall(a) rep(i,0,a.size()) cout<<a[i]<<" "; cout<<endl;
//this is the end of shubhams template //
int power(int a,int n);
void solve();
int find(int num)
{
	int ans = 0;
	for(int i = 1 ;i*i<=num ;i++)
	{
		if(num%i == 0)
		{
			ans ++;
			if(num/i != i)
				ans++;
		}
	}
	return ans;
}
int32_t main()
{
	input();
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    int n ,ans = 0,ans1 = 0;
    cin>>n;
    vector<int>a(n+1,1);
  	for(int i = 2;i<=n ;i++)
  	{
  		for(int j = i ;j<= n ;j+=i)
  			a[j]++;
  	}
  	for(int i = 1;i<n;i++)
  		{
  			//cout<<i<<" "<<a[i]<<endl;
  			ans1 += a[i];
  		}
  	// for(int i = 1;i<n ;i++)
  	// 	{
  	// 	//	cout<<n-i<<" " <<find(n-i)<<" "<<endl;
  	// 		ans += find(n-i);
  	// 	}
  	cout<<ans1<<endl;
  //  cout<<ans<<endl;
}
int power(int a,int n)
{
    if(n==0)
        return 1;
    if(n%2!=0)
    {
        return (a*power((a*a),n/2));
    }
    return power((a*a),n/2);
}

//shubham gupta


Measured memory_bytes: 11096
#include <iostream>
#include <string>
#include <cstring>
#include <algorithm>
#include <functional>
#include <cmath>
#include <set>
#include <queue>
#include <deque>
#include <vector>
#include <climits>
#include <sstream>
#include <iomanip>
#include <map>
#include <stack>
using namespace std;
typedef unsigned long long ull;
typedef long long ll;

int main()
{
	int N, C;
	cin >> N >> C;
	vector<vector<int>> D(C, vector<int>(C));
	for (auto& tempD : D)
	{
		for (auto& d : tempD)
		{
			cin >> d;
		}
	}

	vector<vector<int>> num(3, vector<int>(C));
	for (auto i = 1; i <= N; ++i)
	{
		for (auto j = 1; j <= N; ++j)
		{
			int c;
			cin >> c;
			--c;
			auto index = (i + j) % 3;
			++num[index][c];
		}
	}

	auto ans = INT_MAX;
	for (auto i = 0; i < C; ++i)
	{
		for (auto j = 0; j < C; ++j)
		{
			if (i == j)
			{
				continue;
			}

			for (auto k = 0; k < C; ++k)
			{
				if (i == k || j == k)
				{
					continue;
				}

				auto sum = 0;
				for (auto l = 0; l < C; ++l)
				{
					sum += D[l][i] * num[0][l];
					sum += D[l][j] * num[1][l];
					sum += D[l][k] * num[2][l];
				}
				ans = min(ans, sum);
			}
		}
	}
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
/// @file

#include <cmath>
#include <iostream>

namespace {

bool run(std::istream& is, std::ostream& os);
}  // unnamed namespace

/// @brief エントリポイント
#ifdef _TEST
static int run()
#else
int main()
#endif
{
  try {
    if (run(std::cin, std::cout) == false) {
      std::cerr << "main funciton error.\n";
      return EXIT_FAILURE;
    }
  } catch (const std::exception& e) {
    std::cerr << "catch exception\n";
    std::cerr << e.what() << "\n";
    return EXIT_FAILURE;
  }

  return EXIT_SUCCESS;
}

namespace {

/// @brief 実行処理
bool run(std::istream& is, std::ostream& os)
{
  typedef long Num_t;

  Num_t n;
  Num_t p;
  is >> n >> p;

  // n 乗したときに p を超えない最大数を求める
  Num_t maxNum = static_cast<Num_t>(std::ceil(std::pow(p, 1.0 / n)));

  // 最大数から逆側にあまりがなくなる値を求める
  Num_t divisor(maxNum);
  for (; divisor > 0; --divisor) {
    if (p % static_cast<Num_t>(std::pow(divisor, n)) == 0) break;
  }

  os << divisor << '\n';

  return true;
}
}  // unnamed namespace


Measured memory_bytes: 256
def check(a):
    path = []
    for d in a[1:].split("/"):
        if   d == ".": continue
        elif d == "" : d = "/"
        elif d == "..":
            if len(path) == 0 or max(url.find("/"+"/".join(path)+"/") for url in urls) == -1: return False
            path.pop()
            continue
        path.append(d)
    url = ("/"+"/".join(path)).replace("//","/")
    if url in urls: return url
    url = (url+"/index.html").replace("//","/")
    return url if url in urls else False
    
while 1:
    n,m = map(int,raw_input().split())
    if n == 0: break
    urls = [raw_input() for i in xrange(n)]
    for loop in xrange(m):
        a = check(raw_input())
        b = check(raw_input())
        if not (a and b): print "not found"
        elif a != b: print "no"
        else: print "yes"

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

#define rep2(x,fr,to) for(int (x)=(fr);(x)<(to);(x)++)
#define rep(x,to) for(int (x)=0;(x)<(to);(x)++)
#define repr(x,fr,to) for(int (x)=(fr);(x)>=(to);(x)--)
#define all(c) (c).begin(),(c).end()
#define sz(v) (int)(v).size()

using namespace std;
typedef long long ll; typedef vector<int> VI; typedef pair<int,int> pii;
const int MD = (int)1e9 + 7; typedef vector<ll> VL;
void dbg(){ cerr << "\n"; }  template <class T, class ...T2> void dbg(const T& fst, const T2&...rst){ cerr << fst << ": "; dbg(rst...); }
template <class T, class T2> void amax(T& a,T2 b){ if(a < b) a = b;}

int main()
{
	cin.tie(0); ios_base::sync_with_stdio(false);
	int n;
	cin >>n;
	VI a(n), b(n);
	rep(i, n) cin >>a[i];
	
	rep(i, n) b[i] = a[i] - (i+1);
	sort(all(b));
	ll zz = b[n/2];
	ll ans =0;
	rep(i, n) ans += abs(zz - b[i]);
	cout << ans <<"\n";
	return 0;
}


Measured memory_bytes: 1792
#include<bits/stdc++.h>
#include<stdio.h>
#define debug(x) cout << '>' << #x << ':' << x << endl;

#define nitro ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL);
const int INF = 1e9+5;


using namespace std;


int main()
{
	//freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
	//clock_t time_req;time_req = clock();  
	long long int coins;cin>> coins;
	long long int happiness1 = 0;
	happiness1 += (coins/500)*1000;
	coins -= (coins/500)*500;
	happiness1 +=(coins/5)*5;
	cout<<happiness1<<endl;
	//time_req = clock()- time_req;cout << "Time Compexity:"<< (float)time_req/CLOCKS_PER_SEC << " seconds" << endl; 
	return 0;
}

Measured memory_bytes: 256
//ALDS1_5_C Recursion / Divide and Conquer - Koch Curve
#include <cstdio>
#include <cmath>

using namespace std;

struct Point
{
    double x;
    double y;
    Point(){}
    Point(int x1, int y1){
        x = x1;
        y = y1;
    }
    void print()
    {
        printf("%.8f %.8f\n",x,y);
    }

};

void koch(int n,Point p1, Point p2)
{
    if(n==0)
    {
        return;
    }

    Point s,t,u;
    double unit = M_PI / 180.0;
    s.x = (2*p1.x + p2.x)/3.0;
    s.y = (2*p1.y + p2.y)/3.0;
    t.x = (p1.x + 2*p2.x)/3.0;
    t.y = (p1.y + 2*p2.y)/3.0;
    u.x = (t.x-s.x)*cos(60.0*unit) - (t.y-s.y)*sin(60.0*unit) + s.x;
    u.y = (t.x-s.x)*sin(60.0*unit) + (t.y-s.y)*cos(60.0*unit) + s.y;

    koch(n-1,p1,s);
    s.print();
    koch(n-1,s,u);
    u.print();
    koch(n-1,u,t);
    t.print();
    koch(n-1,t,p2);
}

int main(void)
{
    int n;
    scanf("%d",&n);
    Point p1(0,0),p2(100,0);
    p1.print();
    koch(n,p1,p2);
    p2.print();
    return 0;
}


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

set<int> s;
multiset<int> s1;
pair<int,int> p[200005];

int n,k;

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

    cin>>n>>k;
    for(int i=0;i<n;i++)
    {
        int x;
        cin>>x;
        s.insert(x);
        s1.insert(x);
    }

    int br=0;
    for(auto u: s)
    {
        p[br]={s1.count(u),u};
        br++;
    }
    sort(p,p+br);
    /*for(int i=0;i<br;i++)
        cout<<p[i].first<<" "<<p[i].second<<endl;*/
    if(br<=k)
    {
        cout<<0<<endl;
        return 0;
    }
    else
    {
        int tr=0;
        for(int i=0;i<br-k;i++)
            tr+=p[i].first;

        cout<<tr<<endl;
        return 0;
    }

}


Measured memory_bytes: 23800
#include <stdio.h>

main(){
  
  int a,b,temp,r;
  
    scanf("%d %d",&a,&b);
    if(a<b){
      temp=a;
      a=b; 
      b=temp;
    }
    
      
  while((r=a%b)!=0){
    a=b;
    b=r;
  }
  printf("%d\n",b);
}

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

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

#define INF 2e9
#define ALL(v) v.begin(), v.end()

int main(){
  int n,k;
  string s;
  cin>>n>>k>>s;
  --k;
  for (int i=0;i<n;++i){
    if (i==k)
    s[i]=tolower(s[i]);
  }
  cout<<s<<endl;
  return 0;
}


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

const int maxn = 1e6 + 5;

char aux[maxn];

int main() {
	int n, m, k; scanf("%d%d%d", &n, &m, &k);
	int x1, y1, x2, y2; scanf("%d%d%d%d", &x1, &y1, &x2, &y2);
	x1--, y1--, x2--, y2--;

	vector<string> a(n);
	for (string& s : a) {
		scanf(" %s", aux);
		s = string{aux};
	}

	vector<set<int>> row(n), col(m);
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < m; j++) {
			row[i].emplace(j);
			col[j].emplace(i);
		}
	}

	vector<vector<int>> dist(n, vector<int>(m, -1));
	queue<pair<int, int>> q;
	dist[x1][y1] = 0;
	q.emplace(x1, y1);
	row[x1].erase(y1);
	col[y1].erase(x1);

	while(q.size()) {
		auto u = q.front();
		q.pop();

		int cur_dist = dist[u.first][u.second];

		for (set<int>::iterator it = row[u.first].lower_bound(u.second); it != row[u.first].end() && *it <= u.second+k;) {
			dist[u.first][*it] = cur_dist + 1;
			if (a[u.first][*it] == '@') {
				break;
			}
			col[*it].erase(u.first);
			q.emplace(u.first, *it);
			set<int>::iterator nx = next(it);
			row[u.first].erase(*it);
			it = nx;
		}

		if (row[u.first].size() && row[u.first].lower_bound(u.second) != row[u.first].begin())
		for (set<int>::iterator it = prev(row[u.first].lower_bound(u.second)); *it >= u.second - k;) {
			dist[u.first][*it] = cur_dist + 1;
			if (a[u.first][*it] == '@') {
				break;
			}
			q.emplace(u.first, *it);
			col[*it].erase(u.first);
			
			if (it == row[u.first].begin()) {
				row[u.first].erase(*it);
				break;
			} else {
				set<int>::iterator nx = prev(it);
				row[u.first].erase(*it);
				it = nx;
			}
		}

		for (set<int>::iterator it = col[u.second].lower_bound(u.first); it != col[u.second].end() && *it <= u.first+k;) {
			dist[*it][u.second] = cur_dist + 1;
			if (a[*it][u.second] == '@') {
				break;
			}
			row[*it].erase(u.second);
			q.emplace(*it, u.second);
			set<int>::iterator nx = next(it);
			col[u.second].erase(*it);
			it = nx;
		}

		if (col[u.second].size() && col[u.second].lower_bound(u.first) != col[u.second].begin())
		for (set<int>::iterator it = prev(col[u.second].lower_bound(u.first)); *it >= u.first - k;) {
			dist[*it][u.second] = cur_dist + 1;
			if (a[*it][u.second] == '@') {
				break;
			}
			row[*it].erase(u.second);
			q.emplace(*it, u.second);
			
			if (it == col[u.second].begin()) {
				col[u.second].erase(*it);
				break;
			} else {
				set<int>::iterator nx = prev(it);
				col[u.second].erase(*it);
				it = nx;
			}
		}

	}

	printf("%d\n", dist[x2][y2]);
}

Measured memory_bytes: 153736
import copy
N,M = map(int,input().split())
graph = [[] for _ in range(N)]
edge=[]
for i in range(M):
    a,b = map(int,input().split())
    a-=1
    b-=1
    graph[a].append(b)
    graph[b].append(a)
    edge.append((a,b))

d = [1]*N
def bfs(graph,s,d,n):
    for v in graph[s]:
        if d[v]:
            d[v] = 0
            bfs(graph,v,d,n)
    if d.count(0) != n:
        return 1
    else:
        return 0
ans = 0
for i in range(M):
    d = [1]*N
    graph1=copy.deepcopy(graph)
    graph1[edge[i][0]].remove(edge[i][1])
    graph1[edge[i][1]].remove(edge[i][0])
    ans+=bfs(graph1,0,d,N)

print(ans)


Measured memory_bytes: 3572
S = input()
T = input()

min_count = len(S)

for i in range(len(S) - len(T) + 1):
  count = 0
  for j, s in enumerate(T):
    # print(s, S[i+j], s == S[i+j])
    if s != S[i+j]:
      count += 1
  
  if count < min_count:
    min_count = count

print(min_count)

Measured memory_bytes: 9112
//F
#include <bits/stdc++.h>
#define Inf 0x3f3f3f3f
#define rg register
#define pii pair<int, int>
#define mp(x, y) make_pair(x, y)
using namespace std;
typedef long long ll;
const int Maxn = 1e5 + 5;
typedef int arr[Maxn];
//ll Add(ll x, ll y) { return (x += y) >= Mod ? x - Mod : (x < 0 ? x + Mod : x); }
ll min(ll x, ll y) { return x < y ? x : y; }
ll max(ll x, ll y) { return x > y ? x : y; }
inline ll read()
{
	rg ll res = 0, sign = 1;
	rg char ch = getchar();
	while (!isdigit(ch))
	{
		if (ch == '-')
			sign = -1;
		ch = getchar();
	}
	do
	{
		res = (res << 3) + (res << 1) + (ch ^ 48);
		ch = getchar();
	} while (isdigit(ch));
	return res * sign;
}
int n, S, E, cnt, ans;
arr fir, sum, fa, deep, dep, to;
struct
{
	int to, last;
} e[Maxn << 1];
void con(int u, int v)
{
	e[++cnt].to = v;
	e[cnt].last = fir[u];
	fir[u] = cnt;
}
int DFS(int x)
{
	if (x == S)
		to[x] = x;
	for (int next = fir[x], nx; next; next = e[next].last)
	{
		nx = e[next].to;
		if (nx == fa[x])
			continue;
		dep[nx] = dep[x] + 1;
		fa[nx] = x;
		if (DFS(nx))
			to[x] = nx;
		deep[x] = max(deep[x], deep[nx] + 1);
	}
	return to[x];
}
int main()
{
	rg int a, b;
	cin >> n >> S >> E;
	for (int i = 1; i < n; i++)
	{
		a = read();
		b = read();
		con(a, b);
		con(b, a);
	}
	DFS(E);
	while (dep[S] - dep[E] > 2)
	{
		S = fa[S];
		E = to[E];
		ans++;
	}
	ans += dep[S] - dep[E] - 1;
	cout << ans + deep[S] << '\n';
	return 0;
}

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

#define DIV 1000000007

long long BLUE, RED;

vector<vector<long long> > comb;

void combination(int n)
{
	comb.assign(n+1, vector<long long>(n+1, 0));
	for(int i=0; i<=n; ++i){
		comb[i][0] = 1;
		for(int j=1; j<=i; ++j){
			comb[i][j] = comb[i-1][j-1] + comb[i-1][j];
			comb[i][j] %= DIV;
		}
	}
}

long long cal(long long num){
	long long blue = comb[BLUE-1][num-1];
	long long red = comb[RED+1][num];
	return (blue*red)%DIV;
}

int main(){
	long long N, K;
	cin >> N >> K;
	BLUE=K;
	RED=N-K;
	combination(N+10);
	for(long long i = 1; i <=K; i++){
		cout << cal(i) << endl;
	}
}


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

int64_t mod = 1000000007;
int64_t large = 9223372036854775807;
double PI = 3.141592653589793;

int64_t gcd(int64_t p, int64_t q)
{
    if (p < q)
        swap(p, q);

    if (p % q == 0)
        return q;
    else
        return gcd(q, p % q);
}

int main()
{
    int A, B, K, count = 0;
    vector<int> list;
    cin >> A >> B >> K;
    int X = gcd(A, B);
    for (int i = 1; i <= X; i++)
        if (X % i == 0)
            list.push_back(i);
    cout << list[list.size() - K];
}

Measured memory_bytes: 256
from collections import defaultdict
con = 10 ** 9 + 7; INF = float("inf")

def getlist():
	return list(map(int, input().split()))

#処理内容
def main():
	S = input()
	if S == "ABC":
		print("ARC")
	else:
		print("ABC")
	




if __name__ == '__main__':
	main()

Measured memory_bytes: 64672
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <fstream>
#include <sstream>
#include <set>
#include <map>
#include <vector>
#include <list>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <string>
#include <queue>
#include <bitset>     //UWAGA - w czasie kompilacji musi byc znany rozmiar wektora - nie mozna go zmienic
#include <cassert>
#include <iomanip>        //do setprecision
#include <ctime>
#include <complex>
using namespace std;

#define FOR(i,b,e) for(int i=(b);i<(e);++i)
#define FORQ(i,b,e) for(int i=(b);i<=(e);++i)
#define FORD(i,b,e) for(int i=(b)-1;i>=(e);--i)
#define REP(x, n) for(int x = 0; x < (n); ++x)

#define ST first
#define ND second
#define PB push_back
#define MP make_pair
#define LL long long
#define ULL unsigned LL
#define LD long double

const double pi = 3.141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342;
const int mod=1000000007;

//mod演算ライブラリ
//mod=1000000007

LL add(LL a,LL b){
  return (a+b)%mod;
}

LL sub(LL a,LL b){
  return (a+mod-b)%mod;
}

LL mul(LL a,LL b){
  return ((a % mod) * (b % mod)) % mod;
}

LL power(LL x,LL y){//繰り返し二乗法 単品利用可
  if(y==0)return 1;
  else if(y==1)return x%mod;
  else if(y%2==0){
    LL tmp=power(x, y/2) % mod;
    return tmp*tmp%mod;
  }else {
    LL tmp=power(x, y/2) % mod;
    return ((tmp*tmp)%mod)*x%mod;
  }
}

LL div(LL a,LL b){
  return mul(a,power(b,mod-2));
}


int invfact[100005];
int fact[100005];

LL factset(int a){//aまでの階乗%mod表を作成
  fact[0]=1;
  FORQ(i,1,a){
    fact[i]=mul(fact[i-1],i);
  }
}

LL cmbset(int a){//1~aまでの階乗と階乗数の逆元のmod(mod)を用意 O(a)
  factset(a);
  invfact[a]=power(fact[a],mod-2);
  invfact[0]=1;
  FORD(i,a,1){
    invfact[i]=mul(invfact[i+1],i+1);
  }

}

LL cmb(int n,int r){//nCr%mod  (cmbset後に使用)
  if(n<r||r<0||n<0)return 0;
  return mul(fact[n],mul(invfact[r],invfact[n-r]));
}

LL prm(int n,int r){//nPr%mod
    return mul(cmb(n,r),fact[n]);
}

LL homo(int n,int r){//nHr%mod
  return cmb(n+r-1,r);
}














//dummy


int main(){
	int n;
	string s[2]={};
	cin>>n;
	cin>>s[0]>>s[1];
	int ans=1,state=-1;
	//0:ss 1:s
	//  tt   s
	FOR(i,0,n){
		if(s[0][i]==s[1][i]){//s1
			if(state==-1){
				ans=mul(ans,3);
			}else if(state==0){
				//ans=mul(ans,1);
			}else{
				ans=mul(ans,2);
			}
			state=1;
		}else{//s0
			if(state==-1){
				ans=mul(ans,6);
			}else if(state==0){
				ans=mul(ans,3);
			}else{
				ans=mul(ans,2);
			}
			i++;
			state=0;
		}
	}
	cout<<ans<<endl;
    return 0;
}


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

int main(){
  int n, k;
  cin >> n >> k;
  vector<long> tree_h(n);
  vector<long> tree_d(n-k+1);
  for (int i= 0; i < n; i++){
    cin >> tree_h.at(i);
  }
  sort(tree_h.begin(),tree_h.end());
  for (int i= 0; i < n-k+1; i++){
    tree_d.at(i) =  tree_h.at(i+k-1)-tree_h.at(i);
  }
  sort(tree_d.begin(),tree_d.end());
  cout << tree_d.at(0) << endl;
  return 0;
}


Measured memory_bytes: 1792
import math
A = [int(input()) for i in range(5)]
Aa = [i for i in A if i % 10 == 0]
Ab = [i for i in A if not i % 10 == 0]
Ab = sorted(Ab, key=lambda x : (x) % 10, reverse=True)
#print(Aa, Ab)

total = 0
for i in range(len(Aa)):
  total += math.ceil(Aa[i] / 10) * 10
  #print(total)
for i in range(len(Ab)):
  if i +1 == len(Ab):
  	total += Ab[i]
  else:
  	total += math.ceil(Ab[i] / 10) * 10
  #print(total)
  
print(total)


Measured memory_bytes: 3064
#include <iostream>
#include <algorithm>

using namespace std;

int main(){
	int a, b, c, d, e;
	cin >> a >> b >> c >> d >> e;
	int ma, mb, mc, md, me;
	ma = a % 10;
	mb = b % 10;
	mc = c % 10;
	md = d % 10;
	me = e % 10;
	if (ma == 0)ma = 10;
	if (mb == 0)mb = 10;
	if (mc == 0)mc = 10; 
	if (md == 0)md = 10;
	if (me == 0)me = 10;
	int s;
	s = a + (10 - ma) + b + (10 - mb) + c + (10 - mc) + d + (10 - md) + e + (10 - me);
	//cout << s;
	int min=0;
	if (ma != 0)min = ma;
	if (mb != 0 && min > mb)min = mb;
	if (mc != 0 && min > mc)min = mc;
	if (md != 0 && min > md)min = md; 
	if (me != 0 && min > me)min = me;

	cout << s + min-10;


}

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

int main() {
  int a,b,c;
  cin >> a >> b >> c ;
if (a == b){
  if (a == c) cout << 1 << endl;
  else cout << 2;
}
else if (b == c) cout << 2;
else if (a == c) cout << 2;
else cout << 3 ;
}

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

using namespace std;

const int MAX = 32;
typedef pair<string, char> P;
map<char,string> M;

P data[MAX];

bool same(string a,string b){

  for(int i = 0; i < a.length(); i++)
    if(a[i] != b[i]) return false;

  return true;
}

char find(string s){
  for(int i = 0; i < MAX; i++){
    if(s.length() == data[i].first.length())
      if(same(s,data[i].first)) return data[i].second;
  }

  return '!'; 
}

void solve(string in){

  string out = "";
  string ans = "";
  char c;
  for(int i = 0; i < in.length(); i++)
    out += M[in[i]];

  out += "0";
  for(int i = 0; i < out.length(); ){
    int len = 3;
    while(1){
      string check = "";
      for(int j = 0; j < len; j++){
	check += out[i+j];
      }
      if((c = find(check)) != '!') break;
      len++;

      if(i+len >= out.length()){
	cout << ans << endl;
	return;
      }
    }
    ans += c;
    i+=len;
  }
}

string to_b(int num){
  string out = "";
  for(int i = 4; i >= 0; i--){
    if(num >= (1<<i)){
      out += "1";
      num -= (1<<i);
    }else out += "0";
  }

  return out;
}

void make(){
  data[0].first = "101"; data[0].second = ' ';
  data[1].first = "000000"; data[1].second = '\'';
  data[2].first = "000011"; data[2].second = ',';
  data[3].first = "10010001"; data[3].second = '-';
  data[4].first = "010001"; data[4].second = '.';
  data[5].first = "000001"; data[5].second = '?';
  data[6].first = "100101"; data[6].second = 'A';
  data[7].first = "10011010"; data[7].second = 'B';
  data[8].first = "0101"; data[8].second = 'C';
  data[9].first = "0001"; data[9].second = 'D';
  data[10].first = "110"; data[10].second = 'E';
  data[11].first = "01001"; data[11].second = 'F';
  data[12].first = "10011011"; data[12].second = 'G';
  data[13].first = "010000"; data[13].second = 'H';
  data[14].first = "0111"; data[14].second = 'I';
  data[15].first = "10011000"; data[15].second = 'J';
  data[16].first = "0110"; data[16].second = 'K';
  data[17].first = "00100"; data[17].second = 'L';
  data[18].first = "10011001"; data[18].second = 'M';
  data[19].first = "10011110"; data[19].second = 'N';
  data[20].first = "00101"; data[20].second = 'O';
  data[21].first = "111"; data[21].second = 'P';
  data[22].first = "10011111"; data[22].second = 'Q';
  data[23].first = "1000"; data[23].second = 'R';
  data[24].first = "00110"; data[24].second = 'S';
  data[25].first = "00111"; data[25].second = 'T';
  data[26].first = "10011100"; data[26].second = 'U';
  data[27].first = "10011101"; data[27].second = 'V';
  data[28].first = "000010"; data[28].second = 'W';
  data[29].first = "10010010"; data[29].second = 'X';
  data[30].first = "10010011"; data[30].second = 'Y';
  data[31].first = "10010000"; data[31].second = 'Z';

  for(char c = 'A'; c <= 'Z'; c++)
    M[c] = to_b((int)(c-'A'));
 
  M[' '] = "11010";
  M['.'] = "11011";
  M[','] = "11100";
  M['-'] = "11101";
  M['\''] = "11110";
  M['?'] = "11111";
}


int main(){
  string in;
  make();
  while(getline(cin,in)) solve(in);
  return 0;
}

Measured memory_bytes: 1192
#C
import itertools
#入力
n = int(input())
xy = []
a=[]
for i in range(n):
    a += [int(input())]
    xy += [[list(map(int, input().split())) for _ in range(a[i])]]
    
#演算
#bit全捜索
ans = 0
for i in range(2 ** n):
    flag = 0
    for j in range(n):
        #iをjだけシフトした一の位が１である(iのｊ番目が1であるとき)
        if (i >> j) & 1 == 1:
            #xy[j][0]番目がxy[j][1]である供述Statementが現実と矛盾していないか確かめる
            for ParsonStatement in xy[j]:
                if (i >> (ParsonStatement[0] - 1) & 1 )!= ParsonStatement[1]:
                    #矛盾していたらFlagを立ててbreak
                    flag = 1
                    break
    #Flagが立っていない＞＞矛盾点が発見されていない＞＞大丈夫
    if flag == 0:
        ans=max(ans,bin(i)[2:].count("1"))     
print(ans)
            

Measured memory_bytes: 9164
#include<bits/stdc++.h>
using namespace std;
#define REP(i,a,b) for(int i=(a),_ed=(b);i<=_ed;++i)
#define DREP(i,a,b) for(int i=(a),_ed=(b);i>=_ed;--i)
#define mp(x,y) make_pair((x),(y))
#define sz(x) (int)(x).size()
#define pb push_back
typedef long long ll;
typedef pair<int,int> pii;
inline ll read(){
    register ll x=0,f=1;register char ch=getchar();
    while(!isdigit(ch)){if(ch=='-')f=0;ch=getchar();}
    while(isdigit(ch)){x=x*10+(ch^'0');ch=getchar();}
    return f?x:-x;
}

const int inf=1e9;
const ll INF=1e16;
int n,m;char ch[10];
struct node{int x,y;ll v;} a[85];
struct query{int op,a,b;} q[325];
inline void chkmax(int& x,int y){x=x>y?x:y;}
inline void chkmin(int& x,int y){x=x<y?x:y;}

int s,t,num,head[325],vis[325],flow[325],id[325],pre[325];
ll dis[325],ans;
struct edge{int to,next,flo;ll val;} e[200005];
inline void add(int u,int v,int f,ll w){
	e[++num]=(edge){v,head[u],f,w},head[u]=num;
	e[++num]=(edge){u,head[v],0,-w},head[v]=num;
}

bool bfs(){
	queue<int> q;
	REP(i,1,324)dis[i]=-INF;
	memset(vis,0,sizeof vis);
	dis[s]=0,flow[s]=inf,q.push(s),vis[s]=1;
	while(!q.empty()){
		int u=q.front();q.pop(),vis[u]=0;
		for(int i=head[u];i;i=e[i].next){
			int v=e[i].to;
			if(!e[i].flo||dis[v]>=dis[u]+e[i].val)continue;
			dis[v]=dis[u]+e[i].val;
			flow[v]=min(flow[u],e[i].flo);
			id[v]=i,pre[v]=u;
			if(!vis[v])vis[v]=1,q.push(v);
		}
	}
	return dis[t]>-INF;
}
ll network(){
	ll ans=0;
	while(bfs()){
		ans+=dis[t]*flow[t];
		int p=t;
		while(p^s)e[id[p]].flo-=flow[t],e[id[p]^1].flo+=flow[t],p=pre[p];
	}
	return ans;
}

void work(int K){
	int L[165],R[165];
	num=1,memset(head,0,sizeof head);
	s=n+n+K+K+1,t=s+1;
	REP(i,1,n)add(i,n+i,1,a[i].v);
	memset(L,0,sizeof L),memset(R,0x3f,sizeof R);
	REP(t,1,m){
		if(q[t].op==0)REP(i,q[t].b+1,K)chkmax(L[i],q[t].a+1);
		else if(q[t].op==1)REP(i,1,K-q[t].b)chkmin(R[i],q[t].a-1);
		else if(q[t].op==2)REP(i,q[t].b+1,K)chkmax(L[K+i],q[t].a+1);
		else REP(i,1,K-q[t].b)chkmin(R[K+i],q[t].a-1);
	}
	REP(i,1,K){
		add(s,n+n+i,1,0);
		REP(j,1,n)if(L[i]<=a[j].x&&a[j].x<=R[i])add(n+n+i,j,1,0);
	}
	REP(i,K+1,K+K){
		add(n+n+i,t,1,0);
		REP(j,1,n)if(L[i]<=a[j].y&&a[j].y<=R[i])add(n+j,n+n+i,1,0);
	}
	ans=max(ans,network());
}

int main(){
	// freopen("in.in","r",stdin);
	n=read();
	REP(i,1,n)a[i]=(node){read(),read(),read()};
	m=read();
	REP(i,1,m){
		scanf("%s",ch);int o;
		if(ch[0]=='L')o=0;
		else if(ch[0]=='R')o=1;
		else if(ch[0]=='D')o=2;
		else o=3;
		q[i]=(query){o,read(),read()};
	}
	REP(i,1,n)
		work(i);
	printf("%lld\n",ans);
	return 0;
}


Measured memory_bytes: 640
#!/usr/bin/env python3
import collections
import itertools as it
import math
#import numpy as np
 
#  = input()
#  = int(input())
a, b, h, m  = map(int, input().split())
#  = list(map(int, input().split()))
#  = [int(input()) for i in range(N)]
#
# c = collections.Counter()

mr = (m / 60) * 360
hr = ((h * 60 + m) % 720 / 720) * 360
#print(mr, hr)
r = abs(hr - mr)

print(math.sqrt(a ** 2 + b ** 2 - 2 * a * b * math.cos(math.radians(r))))


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

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

    vector<int> sunuke(n, 0);
    for(int i = 0; i < k; i++) {
        int d;
        cin >> d;
        for(int j = 0; j < d; j++) {
            int a;
            cin >> a;
            a--;
            sunuke[a]++;
        }
    }

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

    return 0;
}


Measured memory_bytes: 3628
#include<stdio.h>
#include<stdlib.h>
#include<iostream>
#include<string>
#include<algorithm>
#include<vector> 
#include<limits>
#include<numeric>
#include<type_traits>
#include<math.h>
#include<fstream>
#include<set>
#include<queue>
using namespace std;
typedef long long ll;

const ll MOD = 1e9 + 7; 

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repi(i,a,b) for(int i = (int)(a); i < (int)(b); i++)
#define out(str) cout << str << endl
#define ALL(a) (a).begin(),(a).end()
#define INF_INT (1<<30)
#define INF_LL (1ll<<62)

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

ll n,d,x,y;

int main(){
    int ans = 0;
    cin>>n>>d;
    rep(i,n){
        cin>>x>>y;
        if(x*x+y*y<=d*d)ans++;
    }
    out(ans);
    
}

Measured memory_bytes: 3544
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll, ll>;

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

    int N;
    cin >> N;
    int res = 1;
    for (int i = 0; i < N; ++i) {
        int A;
        cin >> A;
        res *= (A % 2) ? 1 : 2;
    }
    cout << (int)pow(3, N) - res << endl;

    return 0;
}

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

int main(){
	int a, b;
  cin >> a >> b;
   cout << 6 - a -b << endl;
}

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

// 内部定数
#define D_ARRAY_MAX		200000									// 最大配列数

// 内部変数
static FILE *szpFpI;											// 入力
static int si1Array[D_ARRAY_MAX];								// 配列
static int siACnt;												// 配列数

// 内部変数 - テスト用
#ifdef D_TEST
	static int siRes;
	static FILE *szpFpA;
#endif

// ソート関数 - int昇順
int
fSortFnc(
	const void *pzpVal1			// <I> 値１
	, const void *pzpVal2		// <I> 値２
)
{
	int *lipVal1 = (int *)pzpVal1;
	int *lipVal2 = (int *)pzpVal2;

	// 昇順
	if (*lipVal1 > *lipVal2) {
		return(1);
	}
	else if (*lipVal1 < *lipVal2) {
		return(-1);
	}

	return 0;
}

// 実行メイン
int
fMain(
	int piTNo					// <I> テスト番号 1～
)
{
	int i;
	char lc1Buf[1024], lc1Out[1024];

	// 入力 - セット
#ifdef D_TEST
	sprintf(lc1Buf, ".\\Test\\T%d.txt", piTNo);
	szpFpI = fopen(lc1Buf, "r");
	sprintf(lc1Buf, ".\\Test\\A%d.txt", piTNo);
	szpFpA = fopen(lc1Buf, "r");
	siRes = 0;
#else
	szpFpI = stdin;
#endif

	// 配列数 - 取得
	fgets(lc1Buf, sizeof(lc1Buf), szpFpI);
	sscanf(lc1Buf, "%d", &siACnt);

	// 配列 - 取得
	for (i = 0; i < siACnt; i++) {
		fscanf(szpFpI, "%d", &si1Array[i]);

		// 最小の絶対値に変換
		si1Array[i] -= i + 1;
	}
	fgets(lc1Buf, sizeof(lc1Buf), szpFpI);

	// 配列 - ソート
	qsort(si1Array, siACnt, sizeof(int), fSortFnc);

	// 選択値
	int liVal = si1Array[siACnt / 2];

	// 合計値 - 取得
	long long llSum = 0;
	for (i = 0; i < siACnt; i++) {
		llSum += (long long)abs(si1Array[i] - liVal);
	}

	// 結果 - セット
	sprintf(lc1Out, "%lld\n", llSum);

	// 結果 - 表示
#ifdef D_TEST
	fgets(lc1Buf, sizeof(lc1Buf), szpFpA);
	if (strcmp(lc1Buf, lc1Out)) {
		siRes = -1;
	}
#else
	printf("%s", lc1Out);
#endif

	// テストファイルクローズ
#ifdef D_TEST
	fclose(szpFpI);
	fclose(szpFpA);
#endif

	// テスト結果
#ifdef D_TEST
	if (siRes == 0) {
		printf("OK %d\n", piTNo);
	}
	else {
		printf("NG %d\n", piTNo);
	}
#endif

	return 0;
}

int
main()
{

#ifdef D_TEST
	int i;
	for (i = D_TEST_SNO; i <= D_TEST_ENO; i++) {
		fMain(i);
	}
#else
	fMain(0);
#endif

	return 0;
}



Measured memory_bytes: 1788
#include<bits/stdc++.h>
using namespace std;
signed main()
{
    int n;
    cin>>n;
    int f = 0,t=0,o=0;
    for(int i=0;i<n;i++){
        int k;
        cin>>k;
        if(k%4==0)f++;
        else if(k%2==0)t++;
        else o++;
    }
    if(t==0){
        if(f>=o-1)cout<<"Yes"<<endl;
        else cout<<"No"<<endl;
    }
    else{
        if(f>=o)cout<<"Yes"<<endl;
        else cout<<"No"<<endl;
    }

}


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

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

    string s; cin >> s;
    int A[26] = {0};
    for(auto u:s){
        A[u-'a']++;
    }
    for(int i=0;i<26;i++){
        if(A[i]%2==1){
            cout << "No";
            return 0;
        }
    }
    cout << "Yes";


    return 0;
}


Measured memory_bytes: 256
package main

import "fmt"

func main() {
	var s string
	fmt.Scan(&s)
	a, b, c := s[0], s[1], s[2]

	count := 0
	if a == '1' {
		count++
	}
	if b == '1' {
		count++
	}
	if c == '1' {
		count++
	}

	fmt.Println(count)
}


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

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String num = sc.nextLine();
        String[] nums = new String[Integer.parseInt(num)];
        for(int i=0;i<Integer.parseInt(num); i++) {
            nums[i] = sc.nextLine();
        }
        check(num, nums);
    }

    public static void check(String num, String[] nums) {

        int[] vals = new int[nums.length];
        for(int i=0; i<vals.length; i++) {
            vals[i] = Integer.parseInt(nums[i]);
        }
        int max =0;
        int maxi = 0;
        for (int i=0;i<vals.length; i++){
            if(max < vals[i]) {
                max = vals[i];
                maxi = i;
            }
        }
        int max2 = 0;
        for (int i=0;i<vals.length; i++) {
            if(i == maxi) {
                continue;
            }
            if (max2 < vals[i] && max > max2) {
                max2 = vals[i];
            }
        }
        for(int i=0;i<Integer.parseInt(num);i++) {
            if(vals[i] == max) {
                System.out.println(max2);
            } else {
                System.out.println(max);
            }
        }
    }
}

Measured memory_bytes: 173832
def main():
    n = int(input())
    cnt = [0, 0, 0, 0]
    for _ in range(n):
        s = input()
        if s == 'AC':
            cnt[0] += 1
        elif s == 'WA' :
            cnt[1] += 1
        elif s == 'TLE':
            cnt[2] += 1
        elif s == 'RE':
            cnt[3] += 1

    print(f'AC x {cnt[0]}')
    print(f'WA x {cnt[1]}')
    print(f'TLE x {cnt[2]}')
    print(f'RE x {cnt[3]}')


if __name__ == "__main__":
    main()




Measured memory_bytes: 69904
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <map>
#include <set>
#include <vector>
#include <stack>
#include <queue>
#include <bitset>
#include <algorithm>
#include <numeric>
#include <functional>
using namespace std;

#define Rep(b, e, i) for(int i = b; i <= e; i++)
#define Repr(e, b, i) for(int i = e; i >= b; i--)
#define rep(n, i) Rep(0, n-1, i)
#define repr(n, i) Repr(n-1, 0, i)
#define all(v) (v).begin(), (v).end()
#define pb(x) push_back(x)
#define uniq(x) (x).erase(unique(all(x)),(x).end())

typedef long long ll;
typedef pair<ll, ll> llP;
typedef pair<int, int> intP;
typedef std::priority_queue<int> IntPrioQueue; //Z->A
typedef std::priority_queue<int, std::vector<int>, std::greater<int> > IntReversePrioQueue; //A->Z

const int MAX = 1500010;
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const int INF = 1<<29;
const int MOD = 1000000007;

int h[MAX], w[MAX];

void solve(void){
    while (1) {
        int N, M; scanf("%d %d\n", &N, &M);
        if (N == 0 && M == 0) break;
        vector <int> vh, vw;
        memset(h, 0, sizeof(h));
        memset(w, 0, sizeof(w));
        rep(N, i) {
            int hh;
            scanf("%d\n", &hh);
            vh.pb(hh);
        }
        rep(M, i) {
            int ww;
            scanf("%d\n", &ww);
            vw.pb(ww);
        }

        Rep(1, N, k) {
            int tmp = 0;
            rep(k, i) tmp += vh[i];
            h[tmp]++;
            rep(N-k, i) {
                tmp += vh[k+i] - vh[i];
                h[tmp]++;
            }
        }
        Rep(1, M, k) {
            int tmp = 0;
            rep(k, i) tmp += vw[i];
            w[tmp]++;
            rep(M-k, i) {
                tmp += vw[k+i] - vw[i];
                w[tmp]++;
            }
        }
        int ans = 0;
        rep(MAX, i) ans += h[i]*w[i];
        printf("%d\n", ans);
    }

}

int main(void){
  solve();
  return 0;
}



Measured memory_bytes: 15004
#include <iostream>
#include <string>
#include <string.h>
#include <map>
#include <set>
#include <vector>
#include <stdio.h>
#include <math.h>
#include <algorithm>
#include <queue>
#include <cmath>
#include <cstdio>
using namespace std;
int n,m,a[200100],b[200100];
int main() {
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    cin>>n;
    for(int i=0;i<n;i++)
        cin>>a[i];
    cin>>m;
    for(int i=0;i<m;i++)
        cin>>b[i];
    sort(a,a+n);
    sort(b,b+m);
    int nw=0;
    for (int i=0;i<m;i++){
        while(a[nw]!=b[i]){
             nw++;
             if(nw==n){
                       cout<<"NO"<<endl;
                       system("pause");
                       return 0;
             }
        }
        nw++;
}
    cout<<"YES"<<endl;
    system("pause");
    return 0;
}


Measured memory_bytes: 2040