akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <functional>
#include <queue>
#include <string>
#include <cstring>
#include <numeric>
#include <cstdlib>
#include <cmath>
#include <array>
using namespace std;

typedef long long ll;

#define INF 10e17 // 4倍しても(4回足しても)long longを溢れない
#define rep(i,n) for(int i=0; i<n; i++)
#define rep_r(i,n,m) for(int i=m; i<n; i++)
#define END cout << endl
#define MOD 1000000007
#define pb push_back
#define sorti(x) sort(x.begin(), x.end())
#define sortd(x) sort(x.begin(), x.end(), std::greater<int>())
#define debug(x) std::cerr << (x) << std::endl;
#define roll(x) for (auto itr : x) { debug(itr); }

template <class T> inline void chmax(T &ans, T t) { if (t > ans) ans = t;}
template <class T> inline void chmin(T &ans, T t) { if (t < ans) ans = t;}

template <class C, class T>
constexpr void func(C & arr, T N) {
  arr[0] = 1;
  for (int i = 1; i < N; ++i) {
    arr[i] = (arr[i-1] * i) % MOD;
    arr[i] %= MOD;
  }
}

int main() {

  constexpr ll K = 100005;
  ll t1[K], t2[K];

  func(t1, K);
  func(t2, K);
  ll n, m;
  cin >> n >> m;


  if (abs(n - m) >= 2) {
    cout << 0 << endl;
    return 0;
  }


  if (abs(n - m) == 1) {
    cout << (t1[n] * t2[m]) % MOD << endl;
  } else {
    cout << (t1[n] * t2[m] * 2) % MOD << endl;
  }
}


Measured memory_bytes: 1792
use std::collections::HashSet;

fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().split_whitespace()
        .map(|e| e.parse().ok().unwrap()).collect()
}

fn euclidean(a: i32, b: i32) -> i32 {
    if a < b {
        return euclidean(b, a);
    }
    if a % b == 0 { return b; }
    euclidean(b, a % b)
}

pub fn main() {
    let N: i32 = read();
    let As: Vec<i32> = read_vec();
    let mut befores = HashSet::new();
    let mut raw = As[0];
    befores.insert(As[0]);
    befores.insert(As[1]);
    raw = euclidean(As[0], As[1]);
    for a in As[2..As.len()].iter() {
        befores = befores.iter().map(|i| euclidean(*a, *i)).collect();
        befores.insert(raw);
        raw = euclidean(raw, *a);
    }
    println!("{}", befores.iter().max().unwrap());
}

Measured memory_bytes: 6396
#include <iostream>
#include <iomanip>
#include <ctime>
#include <time.h>
#include <string>
#include <algorithm>
#include <math.h>
#include <vector>
#include <stack>
#include <list>
#include <queue>
#include <map>
#include <set>
#include <istream>
#include <ostream>
#include <iterator>
#include <fstream>
#include <stdio.h>
#include <stdlib.h>


using namespace std;

//std::ios::sync_with_stdio(false);

long long n, a[200019], odd_count = 0, even_count = 0;

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

	cin >> n;

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

		if (a[i] % 2 == 0) even_count++;
		else odd_count++;
	}

	if (n == 2)
	{
		if (even_count == odd_count) cout << "NO" << endl;
		else  cout << "YES" << endl;

		return 0;
	}
	
	if (odd_count % 2 == 0)
	{
		cout << "YES" << endl;
		return 0;
	}
	else
	{
		cout << "NO" << endl;
		return 0;
	}
	
	return 0;
	
}

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

using namespace std;

typedef long double ld;
typedef long long ll;

#define sz(x) (int)(x).size()
#define eb emplace_back
#define pb push_back
#define mp make_pair
#define f first
#define s second

template<typename T, typename U> bool ckmin(T &a, U b){ return b < a ? a = b, true : false; }
template<typename T, typename U> bool ckmax(T &a, U b){ return b > a ? a = b, true : false; }

ll a, b, c, d;
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cin >> a >> b >> c >> d;
    cout << max({a * c, a * d, b * c, b * d}) << "\n";
    return 0;
}

Measured memory_bytes: 3648
import queue
r,c=map(int,input().split())
#sy,sx=map(int,input().split())
#gy,gx=map(int,input().split())
a=[list(input()) for i in range(r)]
sy,sx = (1,1)
#gy,gx = (2,2)
def minload(sy,sx,a):
    sy-=1
    sx-=1
    #gy-=1
    #gx-=1
    q = queue.Queue()
    d=[(-1,0),(1,0),(0,-1),(0,1)]
    a[sy][sx]=0
    for i in d:
        if 0<=sy+i[0]<r and 0<=sx+i[1]<c and a[sy+i[0]][sx+i[1]]==".":
            a[sy+i[0]][sx+i[1]]=1
            q.put((sy+i[0],sx+i[1]))
    while True:
        if queue.Queue.empty(q):
            break
        y,x=q.get()
        #if y==r and x==c:
            #break
        for i in d:
            if 0<=y+i[0]<r and 0<=x+i[1]<c and a[y+i[0]][x+i[1]]==".":
                a[y+i[0]][x+i[1]]=a[y][x]+1
                q.put((y+i[0],x+i[1]))
    #print(a[gy][gx])
    max = 0
    for i in a:
        for j in i:
            if j != '#' and j !='.':
                if j > max:
                    max = j
    return(max)
ans = 0
for sy in range(1,r+1): 
    for sx in range(1,c+1):
        b = []
        for i in a:
            b.append(list(i))
        if a[sy-1][sx-1]==".":
            local_max = minload(sy,sx,b)
            #print(local_max)
            #print(b)
        else:
            local_max = 0
        if local_max > ans:
            ans = local_max
print(ans)

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

int as[100001];

int main(){
  int N;
  std::cin>>N;
  for(int i=0;i<N;i++){
    std::cin>>as[i];
  }
  std::sort(as,as+N);
  std::reverse(as,as+N);
  for(int i=0;;i++){
    if(as[i+1]<=i+1){
      int j=i;
      while(as[j+1]>i) j++;
      if((j-i)%2||(as[i]-i-1)%2){
	std::cout<<"First"<<std::endl;
      }else{
	std::cout<<"Second"<<std::endl;
      }
      return 0;
    }
  }
}


Measured memory_bytes: 640
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
using namespace std;
#define REP(i,m,n) for(int i=(int)m ; i < (int) n ; ++i )
#define rep(i,n) REP(i,0,n)
typedef long long ll;
typedef pair<int,int> pint;
typedef pair<ll,int> pli;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;

int main(){
  string s;
  cin >> s;
  if(s.substr(0,4)=="YAKI")cout << "Yes" << endl;
  else cout << "No" << endl;
return 0;}

Measured memory_bytes: 256
#ifdef LOCAL
#include <cstdio>
#include <vector>
#include <algorithm>
#include <iostream>
#include <cstring>
#include <map>
#else
#include <bits/stdc++.h>
#endif
using namespace std ;

typedef long long ll ;
#define rep(i , n ) for ( int i =0; i < n ; i++)
#define _sort(arg) sort(begin(arg), end(arg))
#define MOD 1000000007
#define pb push_back
#define DEBUG(x) cout << #x << ": " << x << endl;

/*
__attribute__((constructor))
void initial()
{
	cin.tie(NULL);
	ios::sync_with_stdio(false);
}
*/

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

	int N, M;
	
	cin >> N >> M;

	//map<int, int> m;

	int a[M], b[M];
	map<int, std::vector<int> >v;

	rep(i, M)
	{
		cin >> a[i] >> b[i];
		/*
		m[a[i]]++;
		m[b[i]]++;
		*/
		v[a[i]].pb(b[i]);
		v[b[i]].pb(a[i]);
	}

	int count = 0;
	/*
	rep(i, M)
	{
		if ((m[a[i]] <= 2) && (m[b[i]] <= 2))
		{
			count++;
		}
	}
	*/
	for (int i = 1; i <= N; i++)
	{
		/*
		if (v.find(i) != end())
		{

		}
		*/
		std::vector<int> ve = v[i];
		for(int j = 0; j < ve.size(); j++)
		{
			if (v[ve[j]].size() < 3)
			{
				count++;
				break;
			}
		}
	}

	cout << count << endl;

	
	return 0;
}
#endif
int N, M;
const int limit = 50;
int graph[limit][limit];
bool visited[limit];

void dfs(int v)
{
	visited[v] = true;

	for(int i = 0; i < N; i++)
	{
		if (graph[v][i] == 0) continue;
		if (visited[i]) continue;
		dfs(i);
	}
}

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

	
	cin >> N >> M;

	int a[M], b[M];
	
	int count = 0;

	memset(graph, 0, sizeof(graph));

	rep(i, M)
	{
		cin >> a[i] >> b[i];
		a[i]--;
		b[i]--;
		graph[a[i]][b[i]] = graph[b[i]][a[i]] = 1; 
	}

	rep(i, M)
	{
		for(int i = 0; i < N; i++)
		{
			visited[i] = false;
		}

		graph[a[i]][b[i]] = graph[b[i]][a[i]] = false;

		dfs(0);

		for(int  i = 0; i < N; i++)
		{
			if (visited[i] == false)
			{
				count++;
				break;
			}
		}

		graph[a[i]][b[i]] = graph[b[i]][a[i]] = true;
	}

	cout << count << endl;

	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <map>
#include <stack>
#include <queue>
using namespace std;
using ll = long long;
using P = pair<int, int>;

int main()
{
    int a, b, c;
    scanf("%d %d %d", &a, &b, &c);

    for (int i = a; i <= a * b; i += a)
    {
        if (i % b == c)
        {
            cout << "YES" << endl;
            return 0;
        }
    }
    cout << "NO" << endl;
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cmath>
#define N 100
using namespace std;

int main() {
	int n;
	cin >> n;
	double x[N], y[N];
	for (int i = 0; i < n; i++) {
		cin >> x[i];
	}
	for (int i = 0; i < n; i++) {
		cin >> y[i];
	}

	double D1, D2, D3, D4 = 0;
	double d[N];
	for (int i = 0; i < n; i++) {
		d[i] = fabs(x[i] - y[i]);
	}

	double sum1 = 0, sum2 = 0, sum3 = 0, sum4 = 0;
	for (int i = 0; i < n; i++) {
		sum1 += d[i];
		sum2 += d[i] * d[i];
		sum3 += d[i] * d[i] * d[i];
	}

	D1 = sum1;
	D2 = pow(sum2, 1.0/2.0);
	D3 = pow(sum3, 1.0/3.0);

	for (int i = 0; i < n; i++) {
		D4 = (D4 < fabs(x[i] - y[i]) ? fabs(x[i] - y[i]) : D4);
	}

	printf("%lf\n%lf\n%lf\n%lf\n", D1, D2, D3, D4);

	return 0;
}


Measured memory_bytes: 3364
#include <algorithm>
#include <bits/stdc++.h>
#include <bitset>
#include <cassert>
#include <cstring>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <math.h>
#include <memory>
#include <queue>
#include <set>
#include <stack>
#include <utility>
#include <vector>
using namespace std;
#define REP(i, n) for (int64_t i = 0; i < (int64_t)n; i++)
#define REP_FOR(i, a, b) for (int64_t i = (int64_t)a; i < (int64_t)b; i++)
#define REP_REV(i, a, b) for (int64_t i = (int64_t)a; i > (int64_t)b; i--)
#define FORALL(v) (v).begin(), (v).end()
#define mp(a, b) make_pair(a, b)
#define eb(x) emplace_back(x)
#define F first
#define S second
typedef long long ll;
typedef long double ld;
typedef pair<int64_t, int64_t> pii;
typedef pair<ll, ll> pll;
typedef pair<ld, ld> pdd;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<int64_t> vii;
typedef vector<vii> vvii;
const ll mod = 1e9 + 7;
const int64_t infi = 1147483600;
const ll infl = 4e18 + 5;
const char EOL = '\n';
//cout << fixed << setprecision(17) << res << endl;
const ll MOD = 998244353;
 
int main() {
    ll N;
    cin >> N;
    vector<ll> A(N);
    for (auto & a : A) {
        cin >> a;
    }
    vector<ll> dp(N, LLONG_MAX);
    dp[0] = 0;
    for (ll i = 1; i < N; ++i) {
        dp[i] = min(dp[i], dp[i-1] + abs(A[i] - A[i-1]));
        if (i > 1) dp[i] = min(dp[i], dp[i-2] + abs(A[i] - A[i-2]));
    }
    cout << dp[N-1] << endl;
}


Measured memory_bytes: 1792
/******************************************************************************

                              Online C++ Compiler.
               Code, Compile, Run and Debug C++ program online.
Write your code in this editor and press "Run" button to compile and execute it.

*******************************************************************************/

#include <bits/stdc++.h>
#define fi first
#define se second
using namespace std;
typedef long long ll;

int main()
{
    int n;
    cin>>n;
    int ans = 1;;
    int x;
    cin>>x;
    int tm = x;
    for(int i=1;i<n;i++){
        cin>>x;
        
        if(tm>x) ans++;
        tm = min(tm,x);
    }
    cout<<ans<<"\n";
    
}


Measured memory_bytes: 256
def check(S,T,i):
	count=0
	for j in range(i,len(T)+i):
		if S[j] != T[j-i]:
			count+=1
	return count

S=input()
T=input()
b=[]
for i in range(0,len(S)-len(T)+1):
	b.append(check(S,T,i))
b.sort()
print(b[0])




Measured memory_bytes: 9016
#include<iostream>
#include<string>
#include<vector>
#include<math.h>
#include<cmath>
#include<stack>
#include <algorithm>
#include <functional>
//#include<stdlib.h>
using namespace std;
int main() {
	double n,k;
	cin >> n>>k;
	cout <<(double(n/k)) ;
	return 0;
}

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

#define X first
#define Y second
#define mp make_pair
#define sz(v) (int) v.size()
#define all(v) v.begin(), v.end()

using namespace std;

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

/*#include<ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
template<typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag,
                         tree_order_statistics_node_update>;*/

void solve() {
	ll n, k;
	cin >> n >> k;
	n %= k;
	cout << min(n, k - n) << "\n";
}

signed main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int tt = 1;
	// cin >> tt;
	while (tt--) solve();
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <cstring>

#include <queue>
#define MAXN 250
#include <string>
#define ll long long
using namespace std;

ll A[MAXN];
ll C[MAXN];

int main(){
	 string s;
	 cin >> s;
	 int k;
	 cin >> k;
	 
	 for(int i = 0;i < s.size();i++){
	 	A[i] = s[i] - '0';
	 }
	for(int i = 0;i < s.size();i++){
		if(k == i + 1 || A[i] != 1) {
			cout << A[i];
			return 0;
		}
	 	if(A[i] == 1) continue;
	 }
	
	return 0;
}

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

#define OnlineJudge1

#define loop(x,a,n) for(int x = a;x < n;x++)
#define NumofDigits(n) ((int)log10(n)+1)
#define CountofNumber(array,n,x)  (upper_bound(array, array+n, x)-lower_bound(array, array+n, x))
#define readline(s) getline(cin,s)
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define EPS 1e-7
#define modulo ll (1e9 + 7)
const long double PI = 3.141592653589793238L;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef pair<int,ll> pill;
typedef pair<ll,ll> pll;

#define debug(...) fprintf(stderr, __VA_ARGS__), fflush(stderr)

#define time__(d) \
    for ( \
        auto blockTime = make_pair(chrono::high_resolution_clock::now(), true); \
        blockTime.second; \
        debug("%s: %lld ms\n", d, chrono::duration_cast<chrono::milliseconds>(chrono::high_resolution_clock::now() - blockTime.first).count()), blockTime.second = false \
    )

void init(){
    cin.tie(0);
    ios::sync_with_stdio(0);
#ifdef OnlineJudge
    freopen("in.txt","r",stdin);
    freopen("out.txt","w",stdout);
#endif
}

int digits[10];

bool check(int n){
    int lastDigit;

    if(n == 0 && digits[0])
        return 0;
    while(n){
        lastDigit = n % 10;
        for(int i = 0;i < 10;i++)
            if(lastDigit == i && digits[i])
                return 0;
        n /= 10;
    }

    return 1;
}
int main(){
    init();

    int n, k;   cin >> n >> k;
    for(int i = 0;i < k;i++){
        int x;  cin >> x;
        digits[x] = 1;
    }

    while(!check(n))n++;

    cout << n;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define HUGE_NUM 99999999999999999
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;


#define SIZE 200005

int N;
int A[SIZE];
ll table[SIZE];

int main(){

	scanf("%d",&N);

	for(int i = 0; i < SIZE; i++){

		table[i] = 0;
	}

	for(int i = 0; i < N; i++){

		scanf("%d",&A[i]);
		table[A[i]]++;
	}

	ll total = 0;
	for(int i = 0; i < SIZE; i++){
		if(table[i] > 1){

			total += (table[i]*(table[i]-1))/2;
		}
	}

	for(int i = 0; i < N; i++){

		if(table[A[i]] == 1){

			printf("%lld\n",total);
		}else{

			printf("%lld\n",total-(table[A[i]]-1));
		}
	}

	return 0;
}


Measured memory_bytes: 5120
#149c
X = int(input())

if X == 2:
    print(2)
else:
    prime_number_list = list()
    prime_number_list.append(2)

    import math
    
    i = 3
    
    continue_flag = True
    
    while continue_flag:
        
        #print(i,":",end = "")
        
        for prime_number in prime_number_list:
            #print(prime_number,",",end="")
            
            if i%prime_number == 0:
                #print(":not pn")
                break
            elif prime_number > math.sqrt(i):
                #print(":pn")
                prime_number_list.append(i)
                
                if i >= X:
                    print(i)
                    continue_flag = False
                break
        
        i += 1

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

#define rep(i, n) for(int i=0; i<(n); ++i)
#define max  200001

//qsort(str, n, sizeof(int), up_comp);
int up_comp(const void *a, const void *b){return *(int*)a - *(int*)b;}
int down_comp(const void *a, const void *b){return *(int*)b - *(int*)a;}
int int_sort( const void * a , const void * b ) {return strcmp(( char * )a , ( char * )b );}
int count_digit(int a){int i=0;while(a!=0){a=a/10;i++;}return i;}
int euclid( int a, int b ){int temp;if(a<b){temp=a;a=b;b=temp;}if(b<1)return -1;if(a%b==0) return b;return euclid(b,a%b);}

int main(void){
 
    int s;
    
    scanf("%d", &s);
    
    if (s==4||s==2||s==1) {
        printf("%d\n", 4);
        return 0;
    }
    
    for (int i=2; i<=1000000; i++) {
        if (s%2==0) {
            s=s/2;
        } else {
            s=3*s+1;
        }
        
        if (s==4||s==2||s==1) {
            printf("%d\n", i+3);
            return 0;
        }
    }
    
    return 0;
}


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

const long long mod=1000000007;

long long dp[2][2000000],cnt[2000000]={},z=0LL;

long long modpow(int a,int b)
{
	if (b==0)
	{
		return 1LL;
	}
	long long ans=modpow(a,b/2);
	ans*=ans;
	ans%=mod;
	if (b%2==1)
	{
		ans*=a;
		ans%=mod;
	}
	return ans;
}

int main(int argc, char const *argv[])
{
	int n;
	cin>>n;
	int a[n];
	for (int i = 0; i < n; ++i)
	{
		cin>>a[i];
	}
	int s[n];
	s[0]=a[0];
	for (int i = 1; i < n; ++i)
	{
		s[i]=s[i-1]^a[i];
	}
	for (int i = 0; i < 2000000; ++i)
	{
		dp[0][i]=1LL;
	}
	for (int i = 0; i < n; ++i)
	{
		if (s[i]==0)
		{
			++z;
		}
		dp[0][s[i]]+=dp[1][s[i]]*(z-cnt[s[i]])%mod;
		dp[0][s[i]]%=mod;
		dp[1][s[i]]+=dp[0][s[i]];
		dp[1][s[i]]%=mod;
		cnt[s[i]]=z;
	}
	if (s[n-1]!=0)
	{
		cout<<dp[0][s[n-1]]<<endl;
	}
	else
	{
		long long ans=modpow(2,z-1);
		for (int i = 1; i < 2000000; ++i)
		{
			ans+=dp[1][i];
			ans%=mod;
		}
		cout<<ans<<endl;
	}
	return 0;
}


Measured memory_bytes: 40960
using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.Text;
//var input = Console.ReadLine().Split().Select(int.Parse).ToArray();
namespace AtCoderSolve
{
    class Solve
    {
        const int mod = 1000000007;
        static void Main(string[] args)
        {
            var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);

            string s = Console.ReadLine();
            long K = long.Parse(Console.ReadLine());
            int ans = 1;
            for (var i = 0; i < Math.Min(s.Length, K); i++) 
            {
                if (s[i] != '1')
                {
                    ans = s[i] - '0';
                    break;
                }
                
            }
            Console.WriteLine(ans);

            Console.Out.Flush();
        }
    }
    


    public class Calculation
    {

    }

    public class Graph
    {

    }
}
    

Measured memory_bytes: 11092
#include <bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define MP make_pair
#define PII pair<int, int>
#define PLL pair<ll, ll>
#define PLI pair<ll, int>
#define PIL pair<int, ll>
#define STR string
#define Fst first
#define Snd second
#define SHN 1e9
#define LSHN 1e18
using namespace std;
string s;
int res=0;
int main()
{
	cin >>s;
	for (int i=0;i<s.size();)
	{
		if (s[i]!='R')
		{
			i++;
			continue;
		}
		int j=i;
		while (s[j]=='R') j++;
		res=max(res,j-i),i=j;
	} 
	cout <<res;
	return 0;
}

Measured memory_bytes: 3628
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <fstream>
#include <numeric>
using namespace std;
typedef long long int ll;

#define EPS (1e-7)
#define INF 1e18
#define max(p,q)((p)>(q)?(p):(q))
#define min(p,q)((p)<(q)?(p):(q))
#define PI (acos(-1))

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

int main() {
    ll N, D;
    cin >> N >> D;
    vector<ll> X(N), Y(N);
    REP(i, N) cin >> X[i] >> Y[i];
    int ans = 0;
    REP(i, N) if (X[i] * X[i] + Y[i] * Y[i] <= D * D) ans++;
    cout << ans << endl;

    return 0;
}



Measured memory_bytes: 6052
#include<stdio.h>
 
int main(){
 
long A,B,V,W,T;
long SA,SB,BA,BB;
while(scanf("%ld %ld",&A,&V)==0);
while(scanf("%ld %ld",&B,&W)==0);
while(scanf("%ld",&T)==0);
 
if(B>A){
BA=A+V*T;
BB=B+W*T;
 
if(BA>=BB){
printf("YES");
}else{
printf("NO");
}
 
}else{
SA=A-V*T;
SB=B-W*T;
 
if(SB>=SA){
printf("YES");
}else{
printf("NO");
}
 
}
 
 
 
return 0;
}

Measured memory_bytes: 1732
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef long long ll;
int main() {
   int a,b,k;
   cin>>a>>b;
   k=(a+b)/2;
   if(a%2==0&&b%2==0) cout<<k<<endl;
   else if(a%2!=0&&b%2!=0) cout<<k<<endl;
   else cout<<"IMPOSSIBLE"<<endl;
}

Measured memory_bytes: 256
import copy

def bubble_sort(A):
    for i in range(len(A)):
        for j in range(len(A)-1, i, -1):
            if A[j]['value'] < A[j-1]['value']:
                tmp = A[j]
                A[j] = A[j-1]
                A[j-1] = tmp


def selection_sort(B):
    for i in range(len(B)):
        mini = i
        for j in range(i, len(B)):
            if B[j]['value'] < B[mini]['value']:
                mini = j
        tmp = B[i]
        B[i] = B[mini]
        B[mini] = tmp


def is_stable(A, B, n):
    for i in range(n):
        if A[i]['suit'] != B[i]['suit']:
            return False
    return True


def show_list(C):
    D = [i['suit'] + i['value'] for i in C]
    print(' '.join(D))
    
n = int(input())
A = [{'suit': i[0], 'value': i[-1]}for i in map(str, input().split())]
B = copy.deepcopy(A)

bubble_sort(A)
show_list(A)
print('Stable')

selection_sort(B)
show_list(B)
if is_stable(A, B, n):
    print('Stable')
else:
    print('Not stable')


Measured memory_bytes: 6348
N,M,C=map(int,input().split())
B=[int(x) for x in input().split()]
o=0
for i in range(N):
    t = C
    A=[int(x) for x in input().split()]
    for j in range(M):
        t += A[j]*B[j]
    o += 1 if (t>0) else 0
print (o)


Measured memory_bytes: 2940
import sys

sys.setrecursionlimit(10 ** 9)


def rec(vv):
    if p[vv] >= 0:
        return p[vv]

    res = 0
    for nv in g[vv]:
        res = max(res, rec(nv) + 1)
    p[vv] = res
    return res


N, M = map(int, input().split())
g = [[] for _ in range(N)]
p = [-1 for _ in range(N)]

for _ in range(M):
    x, y = map(int, input().split())
    x -= 1
    y -= 1
    g[x].append(y)

ans = 0
for v in range(N):
    ans = max(ans, rec(v))
print(ans)


Measured memory_bytes: 59008
#include <iostream>
#include <string>
#include <vector>

using namespace std;

int main()
{
  string s; cin >> s;
  vector<char> sv;
  bool flag = true;
  int s_len = s.length();

  for (char x : s) sv.push_back(x);

  // sortする
  sort(sv.begin(), sv.end());
  for (int i = 0; i < sv.size(); i++) {
    if (sv[i + 1] == sv[i]) {
      flag = false;
      break;
    }
  }

  if (flag) cout << "yes" << endl;
  else      cout << "no" << endl;

  return 0;
}


Measured memory_bytes: 504
#include <stdio.h>

int Rec(int* pai, int add);
int ArrayCopy(int* a, int* b);

int ans[9];
int num;

int main(void){
	int pai[9];
	int next[9];
	int temp;

	while(scanf("%1d", &temp) != EOF){
		for(int i=0; i<9; i++){
			pai[i] = 0;
			ans[i] = 0;
		}
		num = 0;

		pai[temp-1]++;
		for(int i=1; i<13; i++){
			scanf("%1d", &temp);
			pai[temp-1]++;
		}

		for(int i=1; i<10; i++){
			if(pai[i-1]+1 > 4) continue;
			pai[i-1]++;
			for(int j=1; j<10; j++){
				if(pai[j-1] >= 2){
					ArrayCopy(next, pai);
					next[j-1] -= 2;
					Rec(next, i);
				}
			}
			pai[i-1]--;
		}

		//ans output
		for(int i=0; i < num-1; i++){
			printf("%d ", ans[i]);
		}
		if(num != 0)printf("%d\n", ans[num-1]);
		else printf("0\n");
	}

	return 0;
}

int Rec(int* pai, int add){
	int i;
	for(i=0; i<9; i++){
		if(pai[i] != 0) break;
	}
	if(i == 9){
		if(num == 0 || ans[num-1] != add){
			ans[num] = add;
			num++;
		}
		return 1;
	}

	for(i=0; i<9; i++){
		if(pai[i] >= 3){
			int next[9];
			ArrayCopy(next, pai);
			next[i] -= 3;
			Rec(next, add);
		}
	}

	for(i=0; i<7; i++){
		if(pai[i] >= 1 && pai[i+1] >= 1 && pai[i+2] >= 1){
			int next[9];
			ArrayCopy(next, pai);
			next[i]--;
			next[i+1]--;
			next[i+2]--;
			Rec(next, add);
		}
	}

	return 0;
}

int ArrayCopy(int* a, int* b){
	for(int i=0; i<9; i++){
		a[i] = b[i];
	}

	return 0;
}

Measured memory_bytes: 0
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();
		String x = sc.next();

		boolean[] b = new boolean[n];
		int pcx = 0;
		for ( int i=0; i<n; i++ ) {
			if ( x.charAt(i)=='1' ) {
				b[i] = true;
				pcx++;
			} else {
				b[i] = false;
			}
		}

		int pcxp = pcx+1;
		int pcxm = pcx-1;

		int adp = 1;
		int adm = 1;
		long f1p = 0L;
		long f1m = 0L;
		int[] p = new int[n];
		int[] m = new int[n];

		for ( int j=n-1; j>=0; j-- ) {
			p[j] = adp;
			m[j] = adm;

			if ( b[j] ) {
				f1p += (long)adp;
				f1m += (long)adm;
			}
			adp = (adp*2)%pcxp;
			adm = (adm*2)%Math.max(pcxm,1);
		}

		for ( int i=0; i<n; i++ ) {
			long f1 = 0;
			int pcxi = pcx;

			if ( b[i] ) {
				pcxi--;
				f1 = (f1m - (long)m[i] + (long)pcxi)%(long)Math.max(pcxi,1);
			} else {
			        pcxi++;
				f1 = (f1p + (long)p[i])%(long)pcxi;
			}

			if ( pcxi==0 ) {
				System.out.println(0);
				continue;
			}

			int g = getfx(f1, 1);
			System.out.println(g);
		}
	}

	private static int getfx(long fn, int tm) {
		if ( fn==0 ) return tm;
		if ( fn==1 ) return tm+1;

		int pc = getpc(fn);
		return getfx(fn%(long)pc, tm+1);
	}
	private static int getpc(long num) {
		long n1 = num;
		int pc = 0;
		while ( n1>0 ) {
			if ( n1%2L==1 ) pc++;
			n1 /= 2L;
		}
		return pc;
	}
}


Measured memory_bytes: 64880
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int read() {
	int x=0, f=1; char ch=' ';
	while(!isdigit(ch)) {ch=getchar(); if(ch=='-') f=-1;}
	while(isdigit(ch)) x=(x<<3)+(x<<1)+(ch^48), ch=getchar();
	return x*f;
}
int main() {
	int a=read();
	cout<<a+a*a+a*a*a; 
}


Measured memory_bytes: 3636
#include <iostream>
typedef long long int ll;
using namespace std;

int main(){
  ll N,h,n,w;
  cin>>N;

  w=-1;
  for(h=1;w==-1&&h<=3500;h++){
    for(n=h;w==-1&&n<=3500;n++){
      ll factor1 = N * h * n;
      ll factor2 = 4*h*n-N*n-N*h;
      if(factor2>0&&(factor1%factor2)==0){
        w=factor1/factor2;
        goto XX;
      }
    }
  }
 XX:
  cout<<h<<" "<<n<<" "<<w<<endl;
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<cmath>
#include<queue>
#include<map>
#include<set>
#include<list>
#include<iomanip>
#include<vector>
#include<random>
#include<functional>
#include<algorithm>
#include<stack>
#include<cstdio>
#include<bitset>
#include<unordered_map>
#include <climits>
using namespace std;
//---------------------------------------------------
//ライブラリゾーン！！！！
typedef long long ll;
typedef long double ld;
#define str string
#define rep(i,j) for(ll i=0;i<(long long)(j);i++)
#define all(a) (a).begin(),(a).end()
const ll Mod = 1000000007;
const ll gosenchou = 5000000000000000;
short gh[2][4] = { { 0,0,-1,1 },{ -1,1,0,0 } };
struct P {
	ll pos, cost;
};
bool operator<(P a, P b) { return a.cost < b.cost; }
bool operator>(P a, P b) { return a.cost > b.cost; }
struct B {//隣接リスト表現
	ll to, cost;
};
struct E {//辺の情報を入れる変数
	ll from, to, cost;
};
bool operator<(E a, E b) {
	return a.cost < b.cost;
}
struct H {
	ll x, y;
};
bool operator<(H a, H b) {
	if (a.x != b.x) return a.x < b.x;
	return a.y < b.y;
}
bool operator>(H a, H b) {
	if (a.x != b.x) return a.x > b.x;
	return a.y > b.y;
}
bool operator==(H a, H b) {
	return a.x == b.x&&a.y == b.y;
}
bool operator!=(H a, H b) {
	return a.x != b.x || a.y != b.y;
}
struct LS {
	ll num, cost;
	//値、遅延配列
};
ll gcm(ll i, ll j) {//最大公約数
	if (i > j) swap(i, j);
	if (i == 0) return j;
	return gcm(j%i, i);
}
ld rad(H a, H b) {
	return sqrt(pow(a.x - b.x, 2.0) + pow(a.y - b.y, 2.0));
}//rad＝座標上の2点間の距離
ll ari(ll a, ll b, ll c) {
	return (a + b)*c / 2;
}//等差数列の和
ll fact(ll x, ll k, ll p) {//最大値、個数、あまり
	ll sum = 1;
	for (int i = 0; i < k; i++) {
		sum *= (x--);
		sum %= p;
	}
	return sum;
}//階乗(正）
ll mod_pow(ll x, ll n, ll p) {
	ll res = 1;
	while (n > 0) {
		if (n & 1) res = res * x%p;
		x = x * x%p;
		n >>= 1;
	}
	return res;
}//x^n%p
short ctos(char a) {
	return (int)(a - '0');
}
#define int unsigned long long
const long long Inf = 4523372036854775807;
const int inf = 1500000000;
//----------------------------------------------------
//++++++++++++++++++++++++++++++++++++++++++++++++++++
vector<int>b, c;
signed main() {
	int n, k;
	int a[10000];
	cin >> n >> k;
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}
	for (int i = 0; i < n; i++) {
		int sum = 0;
		for (int j = i; j < n; j++) {
			sum += a[j];
			b.push_back(sum);
		}
	}
	for (int i = 40; i >= 0; i--) {
		c.clear();
		for (int j = 0; j < b.size(); j++) {
			if ((1ll << i)&b[j]) {
				c.push_back(b[j]);
			}
		}
		if (c.size() >= k) {
			b.clear();
			for (int j = 0; j < c.size(); j++) {
				b.push_back(c[j]);
			}
		}
		if (i == 0) break;
	}
	int sum = b[0];
	for (int i = 0; i < k; i++) {
		sum &= b[i];
	}
	cout << sum << endl;
}

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

using namespace std;

int main()
{
 	string s;
  cin>>s;
  if(s=="Sunny")cout<<"Cloudy"<<endl;
  else if(s=="Cloudy")cout<<"Rainy"<<endl;
  else cout<<"Sunny"<<endl;
  
  return 0;
}

Measured memory_bytes: 256
import java.util.*;
import java.io.*;

public class Main{

static BufferedReader s1;
static BufferedWriter out;
static String read() throws IOException{String line="";while(line.length()==0){line=s1.readLine();continue;}return line;}
static int int_v (String s1){
    StringBuilder sb=new StringBuilder();
    for(int i=0;i<s1.length();i++){sb.append(s1.charAt(i));}
    return Integer.parseInt(sb.toString());
}
static long long_v(String s1){return Long.parseLong(s1);}
static int[] int_arr() throws IOException{String[] a=read().split("\\s+");int[] b=new int[a.length];for(int i=0;i<a.length;i++){b[i]=int_v(a[i]);}return b;}
static long[] long_arr() throws IOException{String[] a=read().split("\\s+");long[] b=new long[a.length];for(int i=0;i<a.length;i++){b[i]=long_v(a[i]);}return b;}
static void assign(){s1=new BufferedReader(new InputStreamReader(System.in));out=new BufferedWriter(new OutputStreamWriter(System.out));}
//......................................@uthor_Alx..............................................

public static void main(String[] args) throws  IOException{
                assign();
                int t=1;//read().charAt(0)-'0',cn=1;
                while(t--!=0){
                	int n=int_v(read());
                    int[] a=int_arr(); int res=0;
                    Arrays.sort(a);
                    boolean[] b=new boolean[n];
                    for(int i=0;i<n;i++){
                    	for(int j=i+1;j<n;j++){
                    		for(int k=j+1;k<n;k++){
                    			if(a[i]!=a[j]&&a[j]!=a[k]&&a[i]!=a[k]){
                    				if(a[i]+a[j]>a[k]){
                    					res++;
                    				}
                    			}
                    		}
                    	}
                    }
                    out.write(res+"\n");            
                }                
                out.flush();

    }
}

Measured memory_bytes: 36976
while True:
    H, W = map(int, raw_input().split())
    if H == 0 or W == 0:
        break
    even_line = ''
    odd_line  = ''
    for i in xrange(W):
        if i % 2 == 0:
            even_line = even_line + '#'
            odd_line = odd_line + '.'
        else:
            even_line = even_line + '.'
            odd_line = odd_line + '#'
    for i in xrange(H):
        if i % 2 == 0:
            print even_line
        else:
            print odd_line
    print ''

Measured memory_bytes: 6436
def c_prison(N, M, Gate_info):
    left_max = 1
    right_min = N
    for l, r in Gate_info:
        left_max = max(left_max, l)
        right_min = min(right_min, r)
    return right_min - left_max + 1 if left_max <= right_min else 0

N, M = [int(i) for i in input().split()]
Gate_info = [[int(i) for i in input().split()] for j in range(M)]
print(c_prison(N, M, Gate_info))

Measured memory_bytes: 21156
<?php
define("MOD", 10**9+7);
fscanf(STDIN, "%d%d", $n, $k);

nCm($n);//パスカルの三角形を構築
for($i=1; $i <= $k; $i++){
  echo nCm($n-$k+1, $i) * nCm($k-1, $i-1) % MOD, "\n";
}

function nCm($n, $m = 0){
  static $pascal;
  if(!isset($pascal)){
    $pascal[0][0] = 1;
    for($j = 1; $j <= $n; $j++){
      for($i = 0; $i <= $j; $i++){
        $pascal[$j][$i] = (($pascal[$j-1][$i-1] ?? 0) + ($pascal[$j-1][$i] ?? 0)) % MOD;
      }
    }
  }
  return $pascal[$n][$m];
}

Measured memory_bytes: 96760
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace CSharpConsoleApp {

    class Program {

        static int Main() {
            var input = Console.ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray();
            var A = input[0];
            var B = input[1];
            if (A % 3 == 0)
                Console.WriteLine("Possible");
            else if (B % 3 == 0)
                Console.WriteLine("Possible");
            else if ((A + B) % 3 == 0)
                Console.WriteLine("Possible");
            else
                Console.WriteLine("Impossible");

            return 0;
        }
    }
}

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

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

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define endl '\n'
#define optimize() ios_base::sync_with_stdio(0);
int n;
int arr[100001];
int cost[100001];

int func(int index)
{
    if(index>=n-1)
        return 0;
    if(cost[index]!=-1)
        return cost[index];


    if(index+1<=n-1 && index+2<=n-1)
    {
        return cost[index]=min(abs(arr[index]-arr[index+1])+func(index+1),abs(arr[index]-arr[index+2])+func(index+2));
    }

    else if(index+1<=n-1)
    {
        return cost[index]=abs(arr[index]-arr[index+1])+func(index+1);
    }


}
int main()
{
    optimize();

    cin>>n;
    for(int i=0;i<n;i++)
    {
        cin>>arr[i];
    }

    memset(cost,-1,sizeof(cost));

    int res=func(0);
    cout<<res<<endl;
}



Measured memory_bytes: 7520
MOD = 10**9+7

N = int(input())

X = input()
input()

from itertools import chain

d = {(2,2):3, (1,2):1, (2,1):2, (1,1):2, (2,0):6, (1,0):3, (0,0):1}

r = 1
p = 0
n = 0
l = None
for x in chain(X,(None,)):
  if x == l:
    n += 1
  else:
    l = x
    r *= d[(n,p)]
    r %= MOD
    p = n
    n = 1

print(r)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
int main() {
  int a;
  for (int i = 0; i < 5; i++) {
    cin >> a;
    if (a == 0) {
      cout << i + 1 << "\n";
      return 0;
    }
  }
}

Measured memory_bytes: 3596
import java.util.Scanner;

public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] array = new int[n];
		for(int i = 0;i < n;i++){
			array[i] = sc.nextInt();
		}
boolean a = true;
		for(int i = 0;i < n;i++){
			if(array[i]%2 == 0){
				if(!(array[i]%3 == 0 || array[i]%5 == 0)){
					a = false;

				}
			}
		}

		if(a){
			System.out.println("APPROVED");
		}else{
			System.out.println("DENIED");
		}

		}
}

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

int main(int argc,void **argv)
{
  int y;
  int m;
  int d;
  
  scanf("%d/%d/%d",&y,&m,&d);
  if( y < 2019 ){
    printf("Heisei\n");
  }
  else{
    if(y == 2019 && m < 4){
      printf("Heisei\n");
    }
    else{
      if(y == 2019 && m == 4 && d <= 30){
        printf("Heisei\n");
      }
      else{
        printf("TBD\n");
      }
    }
  }
}

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

ans = 0

for i in range(N):
    if B[i] <= A[i]:
        ans += B[i]
    else:
        ans += A[i]
        remat = B[i]-A[i]
        if A[i+1] - remat < 0:
            ans += A[i+1]
        else:
            ans += remat
        
        A[i+1] = max(0,A[i+1]-remat)

print(ans)

Measured memory_bytes: 97660
N = gets.to_i
A = gets.split.map(&:to_i)
B = gets.split.map(&:to_i)
C = gets.split.map(&:to_i)

sum = B.inject(:+)

A.each_cons(2) do |a|
  if a[1] - a[0] == 1
    sum += C[(a[0]-1)]
  end
end
  
puts sum

Measured memory_bytes: 1788
#include <iostream>

using namespace std;

int main() {
    int K, S;
    cin >> K >> S;
    long long int ans=0;
    for(int x=0; x<=K; x++) {
        for(int y=0; y<=K; y++) {
            if(S-x-y<=K && S-x-y>=0) ans++;
        }
    }
    
    cout << ans << endl;


    return 0;
    
}

Measured memory_bytes: 256
//you never give up.
#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define v32 vector<int>
#define v64 vector<ll>

using namespace std;
//AC, WA, TLE, or RE.
void solve()
{
    ll k;
    cin >> k;
    ll ac, wa, tle, re;
    ac = 0;
    wa = 0;
    tle = 0;
    re = 0;
    while (k--)
    {
        string yo;
        cin >> yo;
        if (yo == "AC")
        {
            ac++;
        }
        else if (yo == "WA")
        {
            wa++;
        }
        else if (yo == "TLE")
        {
            tle++;
        }
        else if (yo == "RE")
        {
            re++;
        }
    }
    cout << "AC"
         << " "
         << "x"
         << " " << ac << endl;
    cout << "WA"
         << " "
         << "x"
         << " " << wa << endl;
    cout << "TLE"
         << " "
         << "x"
         << " " << tle << endl;
    cout << "RE"
         << " "
         << "x"
         << " " << re << endl;
}
int main()
{
    int t;
    
    t = 1;
    while (t--)
    {
        solve();
    }
}

Measured memory_bytes: 3632
a = int(input())
b = int(input())
c = int(input())
x = int(input())

res = 0

for aa in range(0, a+1):
    for bb in range(0, b+1):
        for cc in range(0, c+1):
            if (500*aa)+(100*bb)+(50*cc) == x:
                res += 1

print(res)


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

///******************************** C o n t a i n e r ********************************///

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<pii> vii;
typedef vector<pll> vll;

///*********************************** C o n s t ***********************************///

const int       N=1e6+3;
const double    PI = acos(-1);
const ll        MOD=1000000007;                 ///1e9+7
ll dx[] = {+1, 0, -1, 0, +1, +1, -1, -1};
ll dy[] = {0, +1, 0, -1, +1, -1, +1, -1};

///********************************** M a r c o ***********************************///

#define pb push_back
#define F first
#define S second
#define test int tc; cin>>tc; while(tc--)
#define forn(i,n) for(i=0;i<n;i++)
#define rforn(i,n) for(i=n-1;i>=0;i--)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define sz(x) x.size()
#define el <<'\n'
#define sp <<' '
#define print(a) {for(auto x:a)cout<<x<<" ";cout<<endl;}
#define mem(a,b) memset(a, b, sizeof(a))
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) (a*(b/gcd(a,b)))
#define sqr(a) (a)*(a)

#define fastio() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define file() freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
#define fraction() cout.unsetf(ios::floatfield); cout.precision(10); cout.setf(ios::fixed,ios::floatfield);

///*********************************** F u n c t i o n ***********************************///

ll powmod(ll a,ll b){ll p=MOD;a%=p;if(!a) return 0;ll pr=1;while(b>0){if(b&1){pr*=a;pr%=p;--b;}a*=a;a%=p;b/=2;}return pr;}
bool isPrime(ll n){ if(n<=1)return false;if(n<=3)return true;if(n%2==0 or n%3==0)return false;for(ll i=5;i*i<=n;i+=6){if(n%i==0 or n%(i+2)==0)return false;}return true;}
void seive(bool a[]){ll mx=sqrt(N),ii,jj;for(ii=3;ii<=mx;ii+=2)if(!a[ii])for(jj=ii*ii;jj<=N;jj+=2*ii)a[jj]=true;}
void numofdiv(ll a[]){ll mx=sqrt(N),ii,jj;for(ii=1;ii<=mx;ii++){for(jj=ii*ii;jj<=N;jj+=ii){if(jj==ii*ii) a[jj]++; else a[jj]+=2;}}}
void sumofdiv(ll a[]){ll mx=sqrt(N),ii,jj;for(ii=1;ii<=mx;ii++){for(jj=ii*ii;jj<=N;jj+=ii){if(jj==ii*ii) a[jj]+=ii; else a[jj]+=ii+jj/ii;}}}

///**************************************************** C o d e ****************************************************///
///-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=///



void _case()
{
    ll n;
    cin>>n;
    cout<<3*n*n el;

}

main()
{
//      fastio();
        _case();

}


///Thank you.


///Brainless_Loco Terminates Here!


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

using namespace std;
typedef long long ll;

#define REP(i, n) for (ll i = 0; i < (n); i++)
#define REPR(i, n) for (ll i = (n); i >= 0; i--)
#define FOR(i, m, n) for (ll i = (m); i < (n); i++)
#define FORR(i, m, n) for (ll i = (m); i >= (n); i--)
#define INF 1e9
#define pb push_back
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((ll)(x).size())
#define SORT(x) sort((x).begin(), (x).end())
#define dump(x) cerr << #x << " = " << (x) << endl
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" \
                      << " " << __FILE__ << endl

int main(int argc, char const *argv[])
{
    ll a, b, c;
    cin >> a >> b >> c;
    string res = (a + b >= c) ? "Yes" : "No";
    cout << res << endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//using namespace __gnu_pbds;
using namespace std;
#define ll long long
#define ff first
#define ss second
#define pb push_back
#define deb(x) cout<<x<<"\n";
#define deB(x,y) cout<<x<<" "<<y<<"\n";
#define Deb(x,y,z) cout<<x<<" "<<y<<" "<<z<<"\n";
#define YES cout<<"YES\n";
#define Yes cout<<"Yes\n";
#define NO cout<<"NO\n";
#define No cout<<"No\n";
#define clt(x) 63-__builtin_clzll(x)
#define bct(x) __builtin_popcountll(x)
#define all(v) (v).begin(),(v).end()
#define pi pair<ll,ll>
#define vi vector<ll>
#define vpi vector<pair<ll,ll>>
#define maxq priority_queue<ll>
#define minq priority_queue<ll,vector<ll>, greater<ll>>
#define cont continue;
#define reto return 0;
#define sz size()
#define spmod 1116295198451
#define mod 1000000007
#define md 998244353 
#define N 2e5+10
//typedef tree<int,null_type, less<int>, rb_tree_tag,tree_order_statistics_node_update> //pbds;

string  s[1009];
ll dist[1009][1009];
#define inf 1e13
int main()
{
  ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
  //freopen("input.txt", "r", stdin);
  //freopen("output.txt", "w", stdout);
  ll h,w,r,t,n,m,j,x,y;
  cin>>h>>w>>r>>t>>n>>m;
  ll i=0;
  while(i<h)
    cin>>s[i++];
  i=0;
  while(i<=h)
  {
    j=0;
    while(j<=w)
    {
      dist[i][j]=inf;
      j++;
    }
    i++;
  }
  priority_queue<pair<ll,pi>,vector<pair<ll,pi>>,greater<pair<ll,pi>>> pq; 
    pq.push({0, {r-1,t-1}}); 
    dist[r-1][t-1] = 0; 
    //ll par[V+1]={};
    ll v,weight;
    pi u;
    while (!pq.empty()) 
    { 
        u = pq.top().ss; 
        x=u.ff;
        y=u.ss;
        //Deb(x,y,dist[x][y])
        pq.pop(); 
        i=x-2;
        while(i<=x+2)
        {
          j=y-2;
          while(j<=y+2)
          {
            if((i==x&&y==j)||i<0||j<0||i>=h||j>=w||s[i][j]=='#')
            {

            }
            else
            {
              //deB(i,j)
              if(i==x)
              {
                if(abs(j-y)==1&&dist[i][j]>dist[x][y])
                {
                  dist[i][j]=dist[x][y];
                  pq.push({dist[i][j],{i,j}});
                }
                else if(dist[i][j]>1+dist[x][y])
                {
                  dist[i][j]=1+dist[x][y];
                  pq.push({dist[i][j],{i,j}}); 
                }
              }
              else if(j==y)
              {
                if(abs(i-x)==1&&dist[i][j]>dist[x][y])
                {
                  dist[i][j]=dist[x][y];
                  pq.push({dist[i][j],{i,j}});
                }
                else if(dist[i][j]>1+dist[x][y])
                {
                  dist[i][j]=1+dist[x][y];
                  pq.push({dist[i][j],{i,j}}); 
                }
              }
              else if(dist[i][j]>1+dist[x][y])
              {
                  dist[i][j]=1+dist[x][y];
                  pq.push({dist[i][j],{i,j}});
              }
            }
            j++;
          }
          i++;
        }
    }
    if(dist[n-1][m-1]==inf)
      deb(-1)
    else
      deb(dist[n-1][m-1])
}

Measured memory_bytes: 12816
//     . .. ... ..... be naame khodaa ..... .... ... .. .     \\

#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair <int, int> pii;
#define pb push_back

inline int in(){int x, y; y = scanf("%d", &x); return x;}

const int N = 1221;

int a[N][N];
int bad[N][N];

int main()
{
	int n = in();
	for(int i = 0; i < n; i++)
	{
		string s;
		cin >> s;
		for(int j = 0; j < n; j++)
			a[i][j] = s[j] - 'a';
	}
	for(int i = 0; i < n + n; i++)
		for(int j = 0; j < n + n; j++)
			a[i][j] = a[i % n][j % n];
	n *= 2;
/*	for(int i = 0; i < n; i++, cerr << endl)
		for(int j = 0; j < n; j++)
			cerr << a[i][j];
	cerr << endl;*/
	for(int i = 0; i < n; i++)
		for(int row1 = i, col1 = 0; row1 >= 0; row1--, col1++)
			for(int row2 = row1 - 1, col2 = col1 + 1; row2 >= 0; row2--, col2++)
				if(a[row1][col1] != a[row2][col2])
					bad[row2][col1] = max(bad[row2][col1], n - abs((row1 - col1) - (row2 - col2))/2);
	for(int i = 0; i < n; i++)
		for(int row1 = i, col1 = n - 1; row1 < n; row1++, col1--)
			for(int row2 = row1 + 1, col2 = col1 - 1; row2 < n; row2++, col2--)
				if(a[row1][col1] != a[row2][col2])
					bad[row1][col2] = max(bad[row1][col2], n - abs((row1 - col1) - (row2 - col2))/2);
	for(int i = n - 1; i >= 0; i--)
		for(int j = n - 1; j >= 0; j--)
			bad[i][j] = max(bad[i][j], bad[i + 1][j + 1] - 1);
	int ans = 0;
	for(int i = 0; i < n/2; i++)
		for(int j = 0; j < n/2; j++)
			if(!bad[i][j])
				ans++;

	
/*	for(int i = 0; i < n; i++, cerr << endl)
		for(int j = 0; j < n; j++)
			cerr << a[i][j];
	cerr << endl;
	
	for(int i = 0; i < n; i++, cerr << endl)
		for(int j = 0; j < n; j++)
			cerr << bad[i][j];
	cerr << endl;*/
	
	cout << ans << endl;
}



Measured memory_bytes: 10496
#include <iostream>
#include <math.h>

using namespace std;

int main(){
  int a, b, c, k;
  cin >> a >> b >> c >> k;
  if(a >= b && a >= c) cout << pow(2, k) * a + b + c << endl;
  else if(b >= a && b >= c) cout << pow(2, k) * b + a + c << endl;
  else if(c >= a && c >= b) cout << pow(2, k) * c + b + a << endl;
  return 0;
}

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

#define ll long long

ll gcd(ll a, ll b)
{
    return b == 0 ? a : gcd(b, a % b);
}

int main()
{
    ll n, m;
    scanf("%lld%lld", &n, &m);
    std::string s, t;
    std::cin >> s >> t;
    ll ans = (ll)(n * m) / gcd(n, m);
    ll lim = gcd(n, m);
    for(ll i = 0; i < lim; i++)
    {
        //printf("%d %d\n", (n / lim) * i + 1, (m / lim) * i + 1);
        if (s[(n / lim) * i] != t[(m / lim) * i])
            return 0 * printf("-1");
    }
    printf("%lld\n", ans);
    return 0;
}

Measured memory_bytes: 512
taro_p = 0
hana_p = 0
for i in range(input()):
    taro,hana = raw_input().split(' ')
    if taro > hana:
        taro_p = taro_p + 3
        hana_p = hana_p + 0
    elif taro < hana:
        taro_p = taro_p + 0
        hana_p = hana_p + 3
    else:
        taro_p = taro_p + 1
        hana_p = hana_p + 1

print taro_p,hana_p

Measured memory_bytes: 4220