akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
#define arep(i,x,n) for(int i=int(x);i<(int)(n);i++)
#define rep(i,n) for(long long i = 0;i < n;++i)
#define pi 3.141592653589793
#define eps 0.00000001
#define INF 1e9+7  
using ll = long long; 
using P=pair<int,int>;
using lP=pair<ll,ll>;
using fP=pair<double,double>;

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

ll lcm(ll a,ll b){
    return a*b/gcd(a,b);
}

int main(){
    ll a,b,c,d;
    cin>>a>>b>>c>>d;
    ll e=b/c,f=(a-1)/c,g=b/d,h=(a-1)/d;
    ll l=lcm(c,d);
    ll i=b/l,j=(a-1)/l;
    ll ans=b-a+1-(e-f)-(g-h)+(i-j);
    cout<<ans<<endl;

    return 0;
}

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

int main(void)
{
    int l, m, n;
    int save;
    int month;
    int flag;
    
    while (1){
        scanf("%d", &l);
        if (l == 0){
            break;
        }
        
        save = 0;
        flag = 0;
        for (month = 1; month <= 12; month++){
            scanf("%d%d", &m, &n);
        
            save += (m - n);
            if (save >= l && flag == 0){
                printf("%d\n", month);
                flag = 1;
            }
        }
        if (flag == 0){
            printf("NA\n");
        }
    }
    
    return (0);
}

Measured memory_bytes: 0
#include <cstdio>
#include <iostream>
#include <string>
#include <vector>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <typeinfo>
#include <numeric>
#include <functional>
#include <unordered_map>
#include <bitset>
#include <stack>
#include <assert.h>
#include <unordered_set>
#include <random>



using namespace std;
using ll = long long;
using ull = unsigned long long;

const ll INF = 1e16;
const ll MOD = 1e9 + 7;

#define REP(i, n) for(ll i = 0; i < n; i++)

















int main(){
    ll n;
    cin >> n;
    cout << (n - 2) * 180 << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define endl "\n"
#define ll long long 
#define reus ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
int main()
{
	reus;
	ll int a,b,c,k,x;
	cin>>a>>b>>c>>k;
	if(k<=a)
	cout<<k<<endl;
	else if ((k>a)&&((a+b)>=k))
	cout<<a<<endl;
	else if(((a+b)<k)&&(k<=(a+b+c)))
	{
		cout<<(a+((k-(a+b))*(-1)))<<endl;
	}
	
	return 0;
}

Measured memory_bytes: 3652
import sys

input_methods=['clipboard','file','key']
using_method=0
input_method=input_methods[using_method]

tin=lambda : map(int, input().split())
lin=lambda : list(tin())
mod=1000000007

#+++++

def main():
	#a = int(input())
	n, x, t = tin()
	#s = input()
	return ((n + x - 1)//x)*t
	
	
#+++++
isTest=False

def pa(v):
	if isTest:
		print(v)
		
def input_clipboard():
	import clipboard
	input_text=clipboard.get()
	input_l=input_text.splitlines()
	for l in input_l:
		yield l

if __name__ == "__main__":
	if sys.platform =='ios':
		if input_method==input_methods[0]:
			ic=input_clipboard()
			input = lambda : ic.__next__()
		elif input_method==input_methods[1]:
			sys.stdin=open('inputFile.txt')
		else:
			pass
		isTest=True
	else:
		pass
		#input = sys.stdin.readline
			
	ret = main()
	if ret is not None:
		print(ret)

Measured memory_bytes: 61760
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (int)(n); ++i)
#define repe(i,n) for (int i = 1; i <= (int)(n); ++i)
#define rep_bit(n) for (int bit = 0; bit < (1<<n); ++bit)
#define ll long long
using namespace std;
typedef vector<vector<int> > Graph;

int main(){

    string S;
    cin >> S;
    if(S == "ABC") cout << "ARC" << endl;
    else cout << "ABC" << endl;
}


Measured memory_bytes: 3596
N = int(input())
A = [int(x) for x in input().split()]
X = [0]*N
answer = 0
for i in range(N):
  if A[i]==i+1:
    X[i]=1
for i in range(N-1):
  if X[i]==1:
    answer +=1
    X[i+1]=0
if X[N-1]==1:
  answer +=1
print(answer)

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

#define FOR(i, m, n) for (ll i = m; i < ll(n); ++i)
#define READ(v) std::cin >> v;
#define WRITE(v) std::cout << v;
#define USORT(a,n) sort(a, a + n);
#define LSORT(a,n) sort(a, a + n, greater<int>());



#define cin std::cin
#define cout std::cout
using ll = long long;
using ull = unsigned long long;

int main()
{
	string s;
	cin >> s;

	if (s == "Sunny") cout << "Cloudy" << endl;
	else if (s == "Cloudy") cout << "Rainy" << endl;
	else if (s == "Rainy") cout << "Sunny" << endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<iomanip>
#define mins(a,b) a=min(a,b)
#define maxs(a,b) a=max(a,b)
template < typename T > std::string to_string( const T& n )
  {
    std::ostringstream stm ;
    stm << n ;
    return stm.str() ;
  }
using namespace std;

const long long INF=9000000000000000;
int main(){
int n,m,x,ans=0;
cin>>n>>m>>x;
ans=x;
for(int i=0;i<10;i++){
  cout<<ans*n-m<<endl;
  ans=ans*n-m;
}
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define per(i,a,b) for(int i=a;i>=b;i--)
#define clr(a,x) memset(a,x,sizeof(a))
#define SZ(x) ((int)(x).size())
#define lson rt<<1
#define rson rt<<1|1
#define pb push_back
#define fi first
#define se second
#define what_is(x) cerr<<#x<<" "<<x<<endl;
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
template <typename T>
inline void _read(T& x){
    cin>>x;
}
void R(){}
template <typename T,typename... U>
void R(T&head,U&... tail){
    _read(head);
    R(tail...);
}

template <typename T>
inline void _write(const T& x){
    cout<<x<<' ';
}
void W(){cout<<endl;}
template <typename T,typename... U>
void W(const T&head,const U&... tail){
    _write(head);
    W(tail...);
}

void go();
int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    go();
    return 0;
}
/****************ackun*********************/
const int MAXN=25;
int a[MAXN];
void go(){
    int n;
    R(n);
    rep(i,1,n){
        R(a[i]);
    }
    int ans=0;
    rep(i,1,n){
        int x;
        R(x);
        if(a[i]>x){
            ans+=a[i]-x;
        }
    }
    W(ans);
}


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

int main(){
    int n;
    cin >> n;
    string s;
    cin >> s;
    int k;
    k=0;
    if (n%2==1){
        k=2;
    }
    else{
        rep(i,n/2){
            if(s[i]!=s[n/2+i]){
                k=1;
            }
        }
    }
    if(k==0){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long int lli;
int main(){
	lli n;
	cin>>n;
	lli arr[n];
	for(lli i=0;i<n;i++) cin>>arr[i];
	vector<lli>dp(n,0);
	dp[0]=0;dp[1]=abs(arr[0]-arr[1]);
	for(lli i=2;i<n;i++)
		dp[i]=min(dp[i-1]+abs(arr[i]-arr[i-1]),dp[i-2]+abs(arr[i]-arr[i-2]));
	cout<<dp[n-1];
}

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

//定数
const long long MOD1=1000000007;
const long long MOD2=998244353;
const long double PI=3.1415926535897932;
const long long MAXLL=9223372036854775807;
const long long INF=2305843009213693951;
const long long dx[]={0,1,0,-1,1,-1,1,-1};
const long long dy[]={1,0,-1,0,1,1,-1,-1};

//省略
#define ll long long
#define ull unsigned long long
#define ld long double
#define uld unsigned long double
#define pll pair<long long,long long>
#define vl vector<long long>
#define vvl vector<vector<long long>>
#define vvvl vector<vector<vector<long long>>>
#define vc vector<char>
#define vvc vector<vector<char>>
#define vs vector<string>
#define vb vector<bool>
#define vvb vector<vector<bool>>
#define vp vector<pair<long long,long long>>
#define umap unordered_map
#define uset unordered_set
#define Lqueue priority_queue<long long>
#define Squeue priority_queue<long long,vector<long long>,greater<long long>>
#define fi first
#define se second
#define mp make_pair
#define eb emplace_back

//マクロ
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define rbf(a,x) for(auto& a:x)
#define rep(i,n) for(long long i=0;i<(long long)(n);i++)
#define rep2(i,s,n) for(long long i=(s);i<(long long)(n);i++)
#define bitrep(i,s,n) for(long long i=(s);i<(1LL<<(n));i++)
#define bitcheck(bit,i) (bit)&(1LL<<(i))
#define Maxe(x) *max_element((x).begin(),(x).end())
#define Mine(x) *min_element((x).begin(),(x).end())
#define Size(x) ((long long)(x).size())
#define Lin(s) getline(cin,(s))

//Yes,No
void Yes(bool a){cout<<(a?"Yes":"No")<<endl;}
void YES(bool a){cout<<(a?"YES":"NO")<<endl;}

//MAX,MIN
template<class T,class U> auto max(T a,U b){return a>b?a:b;}
template<class T,class U> auto min(T a,U b){return a<b?a:b;}

//最大公約数,最小公倍数
long long gcd(long long a,long long b){return b?gcd(b,a%b):a;}
long long lcm(long long a,long long b){return a/gcd(a,b)*b;}

//切り上げ除算
long long cutup(long long a,long long b){return (a+b-1)/b;}

//累乗
template<typename t>
constexpr t my_pow(t a,long long b){
    if(b==0)return 1;
    if(a==0)return 0;
    t x=1;
    while(b>0){
        if(b&1LL)x*=a;
        a*=a;
        b>>=1LL;
    }
    return x;
}
#define pow my_pow

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

//組み合わせ O(r)
template<typename t>
constexpr t nCr(t n,long long r){
    if(r==0)return 1;
    if(n==0)return 0;
    if(n<r)return 0;
    t x=1;
    for(long long i=1;i<=r;i++){
        x*=n-i+1;
        x/=i;
    }
    return x;
}

signed main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    string s,t;
    cin>>s>>t;
    ll x=Size(s);
    ll y=Size(t);
    ll cnt=y;
    rep(i,x){
        ll k=0;
        if(i+y>x)break;
        rep(j,y){
            if(t[j]==s[i+j])k++;
        }
        chmin(cnt,y-k);
    }
    cout<<cnt<<endl;
}

Measured memory_bytes: 3656
N = int(input())
T,A = map(int, input().split())
H = list(map(int, input().split()))

diff = 1000
index = 0

for i in range(N):
  tmp = abs(A-(T - H[i]*0.006))
  if diff > tmp:
    diff = tmp
    index = i + 1
    
print(index)


Measured memory_bytes: 3060
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define ll long long
#define rep(i,l,r)for(ll i=(l);i<(r);i++)
#define repp(i,l,r,k)for(ll i=(l);i<(r);i+=(k))
#define INF ((1LL<<62)-(1LL<<31))
#define max(p,q)((p)>(q)?(p):(q))
#define min(p,q)((p)<(q)?(p):(q))
#define bit(n,m)(((n)>>(m))&1)
int upll(const void*a, const void*b){return*(ll*)a<*(ll*)b?-1:*(ll*)a>*(ll*)b?1:0;}
int downll(const void*a, const void*b){return*(ll*)a<*(ll*)b?1:*(ll*)a>*(ll*)b?-1:0;}
void sortup(ll*a,int n){qsort(a,n,sizeof(ll),upll);}
void sortdown(ll*a,int n){qsort(a,n,sizeof(ll),downll);}
ll pom(ll a,ll n,int m){ll x=1;for(a%=m;n;n/=2)n&1?x=x*a%m:0,a=a*a%m;return x;}
//#define MOD 998244353
#define MOD 1000000007
#define invp(a,p)pom(a,p-2,p)

ll n,k;
char s[100010];
int main(){
	scanf("%lld%lld",&n,&k);
	scanf(" %s",s);
	
	ll l=0,r=0;
	rep(i,0,k){
		while(r<n&&s[r]=='1')r++;
		while(r<n&&s[r]=='0')r++;
	}
	while(r<n&&s[r]=='1')r++;
	ll ans=r-l;
	while(r<n){
		while(l<r&&s[l]=='1')l++;	
		while(l<r&&s[l]=='0')l++;
		while(r<n&&s[r]=='0')r++;
		while(r<n&&s[r]=='1')r++;
		ans=max(ans,r-l);
//		printf("%lld %lld %lld\n",l,r,ans);
	}
	printf("%lld",ans);
}

Measured memory_bytes: 256
#include<iostream>
#include<cstring>
#include<vector>
#include<queue>
#include<algorithm>
#include<limits.h>

using namespace std;
typedef struct
{
	int cx;
	int cy;
	int turn;
} data;
int main()
{
	int t, n;
	int dx[] = { 0, 1, 1, 0, -1, -1 };
	int dy[] = { 1, 1, 0, -1, -1, 0 };
	while (cin >> t >> n && t != 0 || n != 0)
	{
		static int map[600][600];
		static bool object[600][600];
		memset(object, false, sizeof(object));
		for (int i = 0; i < 600; i++)
		{
			for (int j = 0; j < 600; j++)
			{
				map[i][j] = INT_MAX;
			}
		}

		for (int i = 0; i < n; i++)
		{
			int x, y;
			cin >> x >> y;
			object[y + 300][x + 300] = true;
		}

		int sx, sy;
		cin >> sx >> sy;

		queue<data> q;
		data f;
		f.cx = sx + 300;
		f.cy = sy + 300;
		f.turn = 0;
		map[f.cy][f.cx] = 0;
		q.push(f);
		while (q.size() > 0)
		{
			data d = q.front(); q.pop();
			d.turn++;
			if (d.turn > t)continue;

			for (int i = 0; i < 6; i++)
			{
				int nx = d.cx + dx[i];
				int ny = d.cy + dy[i];
				
				if (nx < 0 || ny < 0 || nx >= 600 || ny >= 600)continue;
				if (object[ny][nx])continue;
				if (map[ny][nx] <= d.turn)continue;
				map[ny][nx] = d.turn;
				data next;
				next.cx = nx;
				next.cy = ny;
				next.turn = d.turn;
				q.push(next);
			}
		}

		int ans = 0;
		for (int i = 0; i < 600; i++)
		{
			for (int j = 0; j < 600; j++)
			{
				if (map[i][j] != INT_MAX)ans++;
			}
		}
		cout << ans << endl;
	}
	return 0;
}

Measured memory_bytes: 2980
# cook your dish here
import bisect 
n,k = map(int,input().split())
x = list(map(int,input().split()))

w  = x.count(0)
for i in range(w):
    x.remove(0)

if k <= w:
    print(0)
else:
    k = k -w
    #print(x)

    r = bisect.bisect_left(x,0)
    
    if x[-1]<0:
        print(abs(x[len(x)-k]))
    elif x[0] > 0:
        print(x[k-1])    
    else:
        ass = 10 ** 10
        ans = 10**10
        for i in range(r,min(len(x),r + k )):
            if i-r+1 >= k:
                ans = abs(x[i])
            
            else:
                if i - k + 1 >= 0:
                    ans = x[i] + abs(x[i-k+1]) + min(x[i],abs(x[i-k+1]))
            ass = min(ass,ans)
        if r-k >= 0:
            ans = abs(x[r-k])
        ass = min(ass,ans)
        print(ass)

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

Measured memory_bytes: 3616
/**
*    created: 24.07.2020 14:26:02
**/
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
// #include <boost/multiprecision/cpp_int.hpp>
// using bint = boost::multiprecision::cpp_int;
using namespace std;
#define int long long
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define pcnt(bit) __builtin_popcountll(bit)
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;}
const long double pi = acos(-1.0);
const int MAX = 1000010;
const int INF = 1LL << 60;
const int MOD = 1000000007;
// const int MOD = 998244353;

signed main() {

    cin.tie(0);
    ios_base::sync_with_stdio(false);

    int n; cin >> n;
    vector<int> v(n+1);
    rep(i,n) cin >> v[i+1];
    vector<int> ans(n+1);
    for (int i = n; i >= 1; i--) {
        int cnt = 0;
        for (int j = i + i; j <= n; j += i) cnt += ans[j];
        cnt %= 2;
        if (v[i] != cnt) ans[i]++;
    }
    vector<int> out;
    rep(i,n) if (ans[i+1] == 1) out.push_back(i+1);
    cout << out.size() << endl;
    int t = out.size();
    rep(i,t) {
        if (i == 0) cout << out[i];
        else cout << " " << out[i];
    } 
    cout << endl;
    return 0;
}

Measured memory_bytes: 7212
s = input()
s1 = s.replace("A","")

t = "KIHBR"

if ("AI" in s) or ("AH" in s) or ("RAA" in s):
    print("NO")
    exit()
    
a = 0
for i in range(len(s)):
    if s[i] == "A":
        a +=1
    elif s[i] != "A":
        if a > 1:
            print("NO")
            exit()
        a = 0
  
if s1 == t:
    print("YES")
else:
    print("NO")

Measured memory_bytes: 9020
#include <iostream>
#include <cstring>
#include <string>
using namespace std;
int main()
{
    char x[5];
    cin >> x;
    if(strstr(x,"AC"))
    {
        cout << "Yes";
    }
    else
    {
        cout << "No";
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 256
n, k = gets.split.map(&:to_i)
xs = gets.chomp.split.map(&:to_i)
min = Float::INFINITY
(0..n-k).each do |i|
  l = xs[i]
  r = xs[i+k-1]
  dist = (l.abs > r.abs) ? r.abs + r - l : l.abs + r - l
  if min > dist
    min = dist
  end
end

puts min


Measured memory_bytes: 9476
#include <bits/stdc++.h>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define all(x) (x).begin(),(x).end()

using namespace std;
using ll = long long;


int main(){
    int a, b;
    cin >> a >> b;
    set<int> p{1, 2, 3};
    p.erase(a);
    p.erase(b);
    for (auto c: p) {
        cout << c << endl;
    }
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        double r = sc.nextDouble();
        System.out.printf("%f %f\n", Math.pow(r, 2) * Math.PI, r * 2 * Math.PI);
        sc.close();
    }
}



Measured memory_bytes: 28236
#include <bits/stdc++.h>
#define ll long long
#define MODV 1000000007
#define INF INT_MAX // 2147483647
#define INFLL LLONG_MAX // 9223372036854775807
#define rep(i, n) for(ll i=0, i##_len=(ll)(n); i<i##_len; i++)
#define repf(i, n) for(ll i=1, i##_len=(ll)(n+1); i<i##_len; i++)
#define per(i, n) for(ll i=((ll)(n))-1; i>=0; i--)
#define perf(i, n) for(ll i=((ll)(n)); i>0; i--)
#define all(v) v.begin(), v.end()
#define endl "\n"
#define vi vector<ll>
#define vvi vector<vector<ll>>
#define Yes() cout << "Yes" << endl
#define YES() cout << "YES" << endl
#define No() cout << "No" << endl
#define NO() cout << "NO" << endl
#define Init() std::ios::sync_with_stdio(false); std::cin.tie(0); std::cout<<fixed<<setprecision(15);
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; }
using namespace std;

int main(){
    Init();
    ll n, y; cin >> n >> y;
    for(ll i=0; i<=n; i++){
        for(ll j=0; j+i<=n; j++){
            ll k = n-i-j;
            if(10000*i + 5000*j + 1000*k == y){
                cout << i << " " << j << " " << k << endl;
                return 0;
            }
        }
    }
    cout << "-1 -1 -1" << endl;
}

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

int n, m;
string fi[210];

int main() {
    cin >> n >> m;
    for (int i = 0; i < n; ++i) cin >> fi[i];
    for (int i = 0; i < n; ++i) {
        for (int j = 0; j < m; ++j) {
            int num = -1;
            for (int k = 0; k <= j; ++k) {
                if (fi[i][k] == 'c') {
                    num = j-k;
                }
            }
            cout << num;
            if (j != m-1) cout << " ";
        }
        cout << endl;
    }
}


Measured memory_bytes: 1224
#include "bits/stdc++.h"
using namespace std;

// Inserted snippets: io, root
#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
template<typename H> bool chmin(H& v1, const H v2) { if (v1 > v2) { v1 = v2; return true; } return false; }
template<typename H> bool chmax(H& v1, const H v2) { if (v1 < v2) { v1 = v2; return true; } return false; }
template<typename H> void read(H& head) { cin >> head; }
template<typename H, typename ...T> void read(H& head, T& ...tail) { cin >> head; read(tail...); }
template<typename H> void write(H head) { cout << head << '\n'; }
template<typename H, typename ...T> void write(H head, T ...tail) { cout << head << " "; write(tail...); }
template<typename ...T> void die(T ...tok) { write(tok...); exit(0); }
// End snippets

int sat[100005], satps[100005], sieve[100005];

int main() {
	cin.tie(0)->sync_with_stdio(0);
	cin.exceptions(cin.failbit);
  
  fill(sieve, sieve + 100005, 1);
  sieve[0] = sieve[1] = 0;
  rep(i, 2, 100005)
    for (ll j = 1ll * i * i; j < 100005; j += i)
      sieve[j] = 0;
  rep(i, 0, 100005)
    sat[i] = (i % 2 == 1 && sieve[i] && sieve[(i + 1) / 2]);
  rep(i, 1, 100005)
    satps[i] = satps[i - 1] + sat[i];
  int q; read(q);
  rep(i, 0, q) {
    int l, r; read(l, r);
    write(satps[r] - satps[l - 1]);
  }
}


Measured memory_bytes: 4800
#include <iostream>

using namespace std;

int main()
{
    int A,B;
    cin >>A>>B;
    if (A+B>=A-B&&A+B>=A*B)
        cout << A+B;
    else if (A-B>=A+B&&A-B>A*B)
        cout <<A-B ;
    else
        cout << A*B ;
    return 0;
}


Measured memory_bytes: 256
class Ufo
  def initialize(x, y, r, v)
    @dist = Math.sqrt(x ** 2 + y ** 2)
    @x = x
    @y = y
    @r = r
    @v = v
    @ex = x / @dist
    @ey = y / @dist
    @vx = -v * @ex
    @vy = -v * @ey
  end
  attr_reader :x, :y, :r, :dist, :ex, :ey
  
  def move
    @dist -= @v
    @x += @vx
    @y += @vy
  end
end

loop do
  radius, n = gets.split.map(&:to_i)
  break if (radius + n).zero?
  
  ufos = n.times.map {Ufo.new(*gets.split.map(&:to_i))}
  count = 0
  
  loop do
    ufos.each(&:move)
    ufos.sort_by! {|u| u.dist}
    
    ufos1 = ufos.select {|u| u.dist <= radius}
    count += ufos1.size
    ufos -= ufos1
    break if ufos.size.zero?
    
    min = ufos.shift
      
    ufos = ufos.reject do |u|
      r = (min.y * u.x - min.x * u.y).abs / min.dist
      r < u.r &&
          u.dist * (min.ex * u.ex + min.ey * u.ey) +
             Math.sqrt(u.r ** 2 - r ** 2) > radius
    end
    break if ufos.size.zero?
  end
  
  puts count
end



Measured memory_bytes: 7144
#
# File    : D.rb
# Author  : Kazune Takahashi
# Created : 2018-12-2 21:13:23
# Powered by Visual Studio Code
#

require 'prime'

n = gets.to_i

hash = {}

for i in 2...100
  if Prime.prime?(i)
    hash[i] = 0
  end
end

for i in 1..n
  num = i
  hash.each{|prime, cnt|
    while num % prime == 0
      num /= prime
      hash[prime] += 1
    end
  }
end

# p hash

ary = Array.new(100){0}

hash.each{|prime, cnt|
  ary[cnt] += 1
}

for i in 0...99
  ary[98 - i] += ary[99 - i]
end

ans = 0
ans += ary[74]
ans += ary[4] * ary[14] - ary[14]
ans += ary[2] * ary[24] - ary[24]
ans += (ary[2] - 2) * ary[4] * (ary[4] - 1) / 2

puts ans


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

int main(){
	cin.tie(0),ios::sync_with_stdio(false);
	int h1,m1,h2,m2,k; cin>>h1>>m1>>h2>>m2>>k;
	cout<<h2*60+m2-h1*60-m1-k<<"\n"s;
}

Measured memory_bytes: 3652
// I SELL YOU...! 
#include<iostream>
#include<vector>
#include<algorithm>
#include<functional>
#include<queue>
#include<chrono>
#include<iomanip>
#include<map>
#include<set>
#include<numeric>
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
using TP = tuple<ll,ll,ll>;
void init_io(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << setprecision(18);
}
signed main(){
  init_io();
  ll k,ans=0;
  cin >> k;
  for(ll i=1;i<=k;i++){
    for(ll j=1;j<=k;j++){
      for(ll l=1;l<=k;l++){
        ll v = gcd(i,gcd(j,l));
        ans += v;
      }
    }
  }
  cout << ans << endl;
}


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

bool isPrime(int n){

	if(n<=1)
		return false;
	if(n==2)
		return true;
	if(n<2 ||n%2==0)
		return false;
	for(int i=3; i*i<=n; i=i+2){
		if(n%i==0)
			return false;
	}

	return true;
}	

int main(){
	int n,cnt=0;
	cin >> n;
	int A[n];
	for(int i=0; i<n; i++)
		cin >>A[i];
	
	for(int i=0; i<n; i++){
		if(isPrime(A[i]))
			cnt++;
	}
	
	cout <<cnt<<endl;
}

Measured memory_bytes: 1196
#include<iostream>
#include<cstring>
#include<algorithm>
#include<vector>
#include<cmath>
#include<limits>
#include<map>
#define ll long long
#define ALL(x) (x).begin(),(x).end()
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define int_INF 2147483647
#define ll_INF 	9223372036854775807
#define MOD 1e+7
#define vi vector<int>
#define vii vector<vector<int>>
#define vll vector<long long>
#define pii pair<int,int>
using namespace std;

void A(){
  string s;
  cin >> s;
  if(s[2] == s[3] and s[4] == s[5]){
    cout << "Yes" << endl;
  }
  else{
    cout << "No" << endl;
  }
}

void B(){
  int Yen;
  cin >> Yen;
  ll Happiness = 0;
  while(Yen >= 500){
    Happiness += 1000;
    Yen -= 500;
  }
  while(Yen >= 5){
    Happiness += 5;
    Yen -= 5;
  }

  cout << Happiness << endl;
}

void C(){
  int K,N;
  cin >> K >> N;
  vector<int> A(N);
  rep(i,N){
    cin >> A[i];
  }
  ll min = A[N-1] - A[0];
  for(int i = 1; i < N; i++){
    ll temp = K - (A[i] - A[i-1]);
    temp < min ? min = temp:1;
  }

  cout << min << endl;
}
int main(){
  A();
}


Measured memory_bytes: 256
#include <stdio.h>

int main () {
	
	int K, A, B;
	scanf("%d %d %d", &K, &A, &B);
	
	int x;
	
	for (A; A <= B; A++){
		if(A % K == 0){
		x++;}
	}
	if(x != 0 ){
		printf("OK ");
	} else{
		printf("NG ");
	}
	
	return 0;
}

Measured memory_bytes: 1732
<?php
$strs = str_split(trim(fgets(STDIN)));

function toInt($n)
{
    return (int) $n;
}

$strs = array_map("toInt", $strs);

$numOfstr = count($strs);

#昇順
#0101
$changeTileCount0 = 0;
for ($i = 0; $i < $numOfstr; $i++) {
	if ($i % 2 === 0 && $strs[$i] === 1) {
    	$changeTileCount0++;
    } else if ($i % 2 === 1 && $strs[$i] === 0) {
    	$changeTileCount0++;
    }
}

#1010
$changeTileCount1 = 0;
for ($i = 0; $i < $numOfstr; $i++) {
	if ($i % 2 === 0 && $strs[$i] === 0) {
    	$changeTileCount1++;
    } else if ($i % 2 === 1 && $strs[$i] === 1) {
    	$changeTileCount1++;
    }
}


#降順
#0101
$reverseStrs = array_reverse($strs);
$changeReverseTileCount0 = 0;
for ($i = 0; $i < $numOfstr; $i++) {
	if ($i % 2 === 0 && $reverseStrs[$i] === 1) {
    	$changeReverseTileCount0++;
    } else if ($i % 2 === 1 && $reverseStrs[$i] === 0) {
    	$changeReverseTileCount0++;
    }
}

#1010
$changeReverseTileCount1 = 0;
for ($i = 0; $i < $numOfstr; $i++) {
	if ($i % 2 === 0 && $reverseStrs[$i] === 0) {
    	$changeReverseTileCount1++;
    } else if ($i % 2 === 1 && $reverseStrs[$i] === 1) {
    	$changeReverseTileCount1++;
    }
}

echo min($changeTileCount0, $changeTileCount1, $changeReverseTileCount0, $changeReverseTileCount1), PHP_EOL;

Measured memory_bytes: 14840
#include <bits/stdc++.h>
using namespace std;
#define FAST std::ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define endl '\n'
#define pb push_back
#define mod 1000000007
#define fr(i,n) for(int i=0;i<n;i++)
#define int long long int
signed main() 
{
    FAST
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    int n;
    cin>>n;
    std::vector<int> v(n),answer(n);
    fr(i,n) cin>>v[i];
    answer[0]=0;
    answer[1]=abs(v[1]-v[0]);
    for(int i=2;i<n;i++)
        answer[i]=min(answer[i-1]+abs(v[i]-v[i-1]),
            answer[i-2]+abs(v[i-2]-v[i]));
    cout<<answer[n-1];
    return 0;
}

Measured memory_bytes: 1792
#ifdef __APPLE__
#include "bits:stdc++.h"
#else
#include <bits/stdc++.h>
#endif

using namespace std;
typedef long long LL;
typedef pair<LL, LL> PLL;
auto scan = []{ static LL a; scanf("%lld", &a); return a;};


string s;
int main() {
  cin >> s;
  LL ans = 0;
  LL beg = 0, ed = s.size() - 1;
  while (beg < ed ) {
    if (s[beg] != 'x' && s[ed] != 'x') {
      if (s[beg] != s[ed]) return 0 * puts("-1");
      else ++beg, --ed;
    }
    else {
      if (s[beg] == 'x' && s[ed] == 'x') ++beg, --ed;
      else if(s[beg] == 'x' && s[ed] != 'x') ++beg, ++ans;
      else ++ans, --ed;
    }
  }
  printf("%lld\n",ans);
}


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

using namespace std;

int main() {
	int n;
	cin >> n;
	int* a = new int[n];
	int* b = new int[n];
	for (int i = 0;i < n;i++) {
		cin >> a[i];
		b[i] = a[i];
	}
	sort(b, b + n);
	for (int i = 0;i < n;i++) {
		if (a[i] == b[n - 1]) {
			cout << b[n - 2] << endl;
		}
		else {
			cout << b[n - 1] << endl;
		}
	}
}

Measured memory_bytes: 4720
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (n);i++)
#define sz(x) int(x.size())
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
constexpr int mod = 1e9 + 7;
 
int main(){ 
  int n, k;
  cin >> n >> k;
  vector<int> a(n);
  rep(i,n) cin >> a[i];
  vector<int> dp(k + 1, 0);

  for (int i = 1; i <= k; i++) {
    for (int j = 0; j < n; j++) {
      if (i - a[j] >= 0) dp[i] |= dp[i - a[j]] ^ 1;
    }
  }
  if (dp[k]) cout << "First" << endl;
  else cout << "Second" << endl;
  return 0;
} 


Measured memory_bytes: 3788
L,R= list(map(int, input().split()))
dis = R-L
if dis >= 2018:
    print(0)
else:
    l = L%2019
    r = R%2019
    if l < r:
        min = 2018
        for i in range(L,R):
            for j in range(i+1, R+1):
                a = (i*j)%2019
                if min > a:
                    min = a
        print(min)

    else:
        print(0)

Measured memory_bytes: 3060
/*/Saya-Javelin/*/
#include <cstdio>
//#pragma GCC optimize("O2")
//#pragma GCC optimize("O3")
#define Fo freopen ("file.in", "r", stdin), freopen ("file.out", "w", stdout)
#define Fc fclose (stdin), fclose (stdout)
#define iln inline
#define rgt register
#define Max(a,b) ((a)>(b)?(a):(b))
#define Min(a,b) ((a)<(b)?(a):(b))
#define Abs(a) ((a)>0?(a):-(a))
#define Swap(a,b) (a)^=(b)^=(a)^=(b)
#define Sqr(x) ((x)*(x))
//#define int long long
#define ll long long
#define ld double

const int S=1000000;
char RRR[S];
char *SSR, *UR;

iln char fgc () {
	if (SSR==UR) UR=(SSR=RRR)+fread (RRR, 1, S, stdin);
	return *SSR++;
}

//#define gc rrr=fgc()
#define gc rrr=getchar()
iln void read (int &ur) {
	int ssr=1; char rrr; ur=0;
	while (gc, rrr>'9' || rrr<'0')
	if (rrr=='-') ssr=-1;
	while (rrr>='0' && rrr<='9')
	ur=ur*10+rrr-'0', gc;
	return (void) (ur*=ssr);
}
#undef gc

iln void write (int ur) {
	if (ur<0) putchar ('-'), ur*=-1;
	if (ur>=10) write (ur/10);
	return (void) putchar (ur%10+'0');
}

iln void wtn (int ur) {
	write (ur);
	return (void) putchar ('\n');
}

iln void wts (int ur) {
	write (ur);
	return (void) putchar (' ');
}

int n, in;
int a[100001];
int ans=0, k=0;
bool wei[33]={0};

signed main (void) {
	read (n);
	for (rgt int i=1; i<=n; ++i) {
		read (a[i]); ans^=a[i];
		for (rgt int j=0; j<=30; ++j) {
			if (a[i]&(1<<j)) {
				wei[j]=1; 
				break;
			}
		}
	}
	for (rgt int i=30; i>=0; --i) {
		if (ans&(1<<i)) {
			if (!wei[i]) return wtn (-1), 0;
			ans^=(1<<(i+1))-1;
			k++;
		}
	}
	wtn (k);
}//hyj ak ioi

Measured memory_bytes: 512
from collections import deque
INF = 5000
vx = [-1,0,1,0]
vy = [0,-1,0,1]

H,W = map(int,input().split())
S = [list(input()) for _ in range(H)]

d = [-1] * (H*W)
xy = lambda x,y: x + y*W

ds = []
for sx in range(W):
    for sy in range(H):
        if S[sy][sx] == '#': continue
        q = deque([(sx,sy)])
        tmpd = d.copy()
        tmpd[xy(sx,sy)] = 0
        while(q):
            x,y = q.popleft()
            for i in range(4):
                nx = x + vx[i]
                ny = y + vy[i]
                if 0 <= nx and nx < W and 0 <= ny and ny < H and S[ny][nx] != '#' and tmpd[xy(nx,ny)] == -1:
                    q.append((nx,ny))
                    tmpd[xy(nx,ny)] = tmpd[xy(x,y)] + 1
        ds.append(max(tmpd))
print(max(ds))

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

#define rep(i, n) for (int i = 0; i < n; ++i)
#define ALL(a) (a).begin(), (a).end()
#define rALL(a) (a).rbegin(), (a).rend()
#define SZ(x) ((int)(x).size())
using ll = long long;
using ull = unsigned long long;
using P = pair<int, int>;
using llP = pair<ll, ll>;
using DoP = pair<double, double>;
const int di[] = {0, 1, 0, -1, 1, 1, -1, -1};
const int dj[] = {1, 0, -1, 0, 1, -1, 1, -1};
const int INF = 1 << 28;
const ll INF64 = 1ll << 55;
const int mod = 1000000007;
//const int mod = 998244353;

template <class T>inline bool chmin(T &a, const T b)
{
  if (a > b)
  {
    a = b;
    return true;
  }
  return false;
}
template <class T>inline bool chmax(T &a, const T b)
{
  if (a < b)
  {
    a = b;
    return true;
  }
  return false;
}
template <class T>inline void line_out(const vector<T> vec) {
  int n = SZ(vec);
  rep(i, n) {
    cout << vec[i];
    if(i < n-1) cout << " ";
  }
  cout << endl;
  return;
}

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

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


int main()
{
  int n; cin >> n;
  map<char, ll> mp;
  rep(i, n) {
    string s; cin >> s;
    if(s[0] != 'M' && s[0] != 'A' && s[0] != 'R' && s[0] != 'C' && s[0] != 'H') continue;
    ++mp[s[0]];
  }
  ll ans = 0;
  vector<char> use = {'M', 'A', 'R', 'C', 'H'};
  for(int i = 0; i < 5; ++i) for(int j = i+1; j < 5; ++j) for(int k = j+1; k < 5; ++k) ans += mp[use[i]]*mp[use[j]]*mp[use[k]];
  cout << ans << endl;
}

Measured memory_bytes: 3600
from collections import deque

h, w = map(int, input().split())
a = [list(input()) for _ in range(h)]

cnt = [[10 ** 10] * w for _ in range(h)]
visited = [[0] * w for _ in range(h)]
queue = deque()
for i in range(h):
    for j in range(w):
        if a[i][j] == "#":
            cnt[i][j] = 0
            queue.append([i, j])
            visited[i][j] = 1

def bfs(q, v, c):
    while q:
        y, x = q.popleft()
        for i, j in ([0, 1], [1, 0], [-1, 0], [0, -1]):
            ny = y + i
            nx = x + j
            if 0 <= nx < w and 0 <= ny < h and v[ny][nx] == 0:
                c[ny][nx] = c[y][x] + 1
                v[ny][nx] = 1
                q.append([ny, nx])

bfs(queue, visited, cnt)

ans = 0
for i in range(h):
    ans = max(ans, max(cnt[i]))
print(ans)

Measured memory_bytes: 217976
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  // 一年の秒数
  int a,b;
  cin >> a >> b;
 
  int amari = a % 500;
  if(amari <= b){
  	cout << "Yes" << endl;
  } else{
  	cout << "No" << endl;
  }
  
  //cout << /* 10年は何秒か */ << endl;
}

Measured memory_bytes: 256
from scipy.sparse import csr_matrix
from scipy.sparse.csgraph import dijkstra
import numpy as np
from collections import Counter

n,x,y=map(int,input().split())

row,col,w=[],[],[]
for i in range(n-1):
  row.append(i)
  col.append(i+1)
  w.append(1)

row.append(x-1)
col.append(y-1)
w.append(1)

g=csr_matrix((w, (row, col)), shape=(n, n))

d=dijkstra(g,directed=False)

l=list(np.ravel(d))

c=Counter(l)
for i in range(1,n):
  print(c[i]//2)

Measured memory_bytes: 203448
#define radhey krishna
#include<bits/stdc++.h>   
using namespace std;
#define ll long long
#define endl "\n"
 const unsigned int M = 1000000007;
//std::set<int> neg ;
 const int MN = 100;
 string v[MN];
  //vector<pair<ll ,ll >>p;
  int solve (string x ,string y){
    int cnt = 0;       
   for(int i = 0; i <x.size() ; i++){
    if(x[i] != y[i])
      cnt++;
   }
   return cnt;
  }   
int main(){  
  #ifndef ONLINE_JUDGE
    // for getting input from input.txt
    freopen("input.txt", "r", stdin);  
    // for writing output to output.txt
    freopen("output.txt", "w", stdout);
#endif
       ios_base::sync_with_stdio(false);  
 string s = "ACL";
 int k;
 cin>>k;
 for(int i = 0; i < k ;i++){   
  cout<<s;
 }
}

Measured memory_bytes: 3624
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>

using namespace std;
typedef long long int ll;
typedef pair<int, int> P;

bool comp(P p1, P p2){
	int h1=p1.first, w1=p1.second, h2=p2.first, w2=p2.second;
	if((h1*h1+w1*w1)!=(h2*h2+w2*w2)){
		return (h1*h1+w1*w1)<(h2*h2+w2*w2);
	}else{
		return h1<h2;
	}
}

int main()
{
	vector<P> v;
	for(int i=1; i<=150; i++){
		for(int j=i+1; j<=150; j++){
			v.push_back(P(i, j));
		}
	}
	sort(v.begin(), v.end(), comp);
	while(1){
		int h, w;
		scanf("%d %d", &h, &w);
		if(h==0 && w==0) return 0;
		P p=*upper_bound(v.begin(), v.end(), P(h, w), comp);

		printf("%d %d\n", p.first, p.second);
	}
}


Measured memory_bytes: 3292
#include<cstdio>

int H, A[2000000];

int parent(int i){
	return i / 2;
}

int left(int i){
	return 2 * i;
}

int right(int i){
	return 2 * i + 1;
}

void helpIncreaseKey(int key){
	int i = H, a;
	A[H] = key;
	while (i > 1 && A[parent(i)] < A[i]){
		a = A[i], A[i] = A[parent(i)], A[parent(i)] = a;
		i = parent(i);
	}
}

void insert(int key){
	H++;
	A[H] = -1;
	helpIncreaseKey(key);
}

void maxHeapify(int A[],int i){
	int l = left(i);
	int r = right(i);
	int largest;
	if (l <= H && A[l] > A[i])
		largest = l;
	else
		largest = i;
	if (r <= H && A[r] > A[largest])
		largest = r;
	if (largest != i){
		int a = A[i];
		A[i] = A[largest], A[largest] = a;
		maxHeapify(A, largest);
	}
}

int heapExtractMax(void){
	int max = A[1];
	A[1] = A[H];
	H--;
	maxHeapify(A, 1);
	return max;
}

int main(void){
	int key;
	char S[10];
	while(scanf("%s", S), S[2] != 'd'){
		if(S[0] == 'i'){
			scanf("%d", &key);
			insert(key);
		}
		else
			printf("%d\n", heapExtractMax());
	}
	return 0;
}

Measured memory_bytes: 6484
/**
 *      purpose : 
 *      author  : kyomukyomupurin
 *      created : 
**/

// input/output
#include <fstream>
#include <iostream>
#include <sstream>
// container class
#include <array>
#include <deque>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <vector>
// math, algorithm
#include <algorithm>
#include <cmath>
#include <complex>
#include <numeric>
// etc
#include <bitset>
#include <cassert>
#include <cctype>
#include <cstring>
#include <chrono>
#include <iomanip>
#include <random>
#include <utility>
// using-directive
using namespace std;
// alias template
using int64 = long long;
using vi = vector<int>;
using vl = vector<int64>;
using pii = pair<int, int>;
using pii = pair<int, int>;
using pll = pair<int64, int64>;
// text macro replacement
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define print(x) cout << (x) << '\n'
#define debug(x) cerr << #x << ": " << (x) << '\n'
#define dbg(v) for (size_t _ = 0; _ < v.size(); ++_){cerr << #v << "[" << _ << "] : " << v[_] << '\n';}
// variadic template
template<typename T> inline void chmin(T &a, T b) {if (a > b) a = b; return;}
template<typename T> inline void chmax(T &a, T b) {if (a < b) a = b; return;}
// constant
const int INF = (1<<30) - 1;
const int64 INF64 = (1LL<<62) - 1;
const int MOD = 1000000007;

int main(){
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  
  string s; //cin >> s;
  if (getline(cin, s)) {
    //cerr << s << endl;
    for (size_t i = 0; i < s.size(); ++i) {
      if (isalpha(s[i])) {
        if (islower(s[i])) {
          cout << (char)toupper(s[i]);
        } else {
          cout << (char)tolower(s[i]);
        }
      } else {
        cout << (char)s[i];
      }
    }
  }
  cout << '\n';

  return 0;
}


Measured memory_bytes: 3200
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  string s;
  cin >> s;
  bool judge = true;
  for(int i = 0; i < s.size() - 1; i++) {
    if(s[i] == s[i + 1]) {
      judge = false;
    }
  }
  if(judge) {
    cout << "Good" << endl;
  }else {
    cout << "Bad" << endl;
  }
}

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

struct Point {
    double x, y;
    Point() : x(0), y(0) {}
    Point(double x, double y) : x(x), y(y) {}
    Point operator+(const Point &a) const {
        return Point(x + a.x, y + a.y);
    }
    Point operator-(const Point &a) const {
        return Point(x - a.x, y - a.y);
    }
    Point operator*(const double &a) const {
        return Point(x * a, y * a);
    }
    Point operator/(const double &a) const {
        return Point(x / a, y / a);
    }
    bool operator<(const Point &a) const {
        return x == a.x ? y < a.y : x < a.x;
    }
};

double cross(const Point &a, const Point &b) {
    return a.x * b.y - a.y * b.x;
}

vector<Point> getConvex(vector<Point> ps) {
    const int N = ps.size();
    sort(ps.begin(), ps.end());
    int k = 0;
    vector<Point> convex(N * 2);
    for(int i = 0; i < N; ++i) {
        while (k > 1 && cross(convex[k - 1] - convex[k - 2], ps[i] - convex[k - 1]) <= 0) k--;
        convex[k++] = ps[i];
    }
    for(int i = N - 2, t = k; 0 <= i; --i) {
        while (t < k && cross(convex[k - 1] - convex[k - 2], ps[i] - convex[k - 1]) <= 0) k--;
        convex[k++] = ps[i];
    }
    convex.resize(k - 1);
    return convex;
}

int64_t dist(Point &a, Point &b) {
    return (int64_t)abs(a.x - b.x) + (int64_t)abs(a.y - b.y);
}

void solve() {
    int N;
    cin >> N;
    vector<Point> ps(N);
    rep(i, N) cin >> ps[i].x >> ps[i].y;
    auto A = getConvex(ps);
    int64_t ans = 0;
    rep(i, A.size()) for(int j = i + 1; j < A.size(); ++j) {
        ans = max(ans, dist(A[i], A[j]));
    }
    cout << ans << '\n';
}

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


Measured memory_bytes: 15928
#include<cstdio>
using namespace std;
int a,b;
int main(){
    scanf("%d%d",&a,&b);
    if(a>0)puts("Positive");               //情况1
    else if(b>=0)puts("Zero");             //情况2
    else if((a&1)^(b&1))puts("Positive"); 
    else puts("Negative");

}

Measured memory_bytes: 128
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}
#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}
#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

use std::cmp::min;

fn main() {
    input! {
        n: usize,
        h: [i32; n],
    }
    let mut dp = vec![0; n];
    for i in (0..(n - 1)).rev() {
        if i == n - 2 {
            dp[i] = dp[i + 1] + (h[i + 1] - h[i]).abs();
        } else {
            dp[i] = min(dp[i + 1] + (h[i + 1] - h[i]).abs(), dp[i + 2] + (h[i + 2] - h[i]).abs());
        }
    }
    println!("{}", dp[0]);
} 


Measured memory_bytes: 4352
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repe(i, n) for (int i = 0; i <= (n); ++i)
#define repr(i, n) for (int i = n - 1; i > 0; --i)
#define all(x) (x).begin(), (x).end()
#define pb(x) push_back(x);
using namespace std;
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;}
typedef long long ll;
const int INF = 1e9;
const ll mod = 1000000007;
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
int lcm(int a, int b) { return a * b / gcd(a, b); }

int main() {
    int n;
    cin >> n;
    rep(i,10) {
        rep (j,10) {
            if (i*j == n) {
                cout << "Yes" << "\n";
                return 0;
            }
        }
    }
    cout << "No" << "\n";
}


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

int main()
{
    double A,B,C,D,E,F;
    cin >> A >> B >> C >> D >> E >> F;

    double maxSugar = 0;
    double maxSum = 0;
    double maxCon = 0;
    for(double a = 0; a*A*100 <= F; a++)
    {
        for(double b = 0; b*B*100 <= F-a*A*100; b++)
        {
            for(double c = 0; c*C <= F-(a*A+b*B)*100; c++)
            {
                for(double d = 0; d*D <= F-(a*A+b*B)*100-c*C; d++)
                {
                    if((a*A*100+b*B*100) > 0)
                    {
                        double Con = (c*C+d*D)/(a*A*100+b*B*100+c*C+d*D);
                        double EC = E/(100+E);
                        if((Con <= EC) && (maxCon <= Con))
                        {
                            maxCon = Con;
                            maxSugar = c*C+d*D;
                            maxSum = a*A*100+b*B*100+c*C+d*D;
                        }
                    }
                }
            }
        }
    }
    cout << maxSum << ' ' << maxSugar << endl;
    return 0;
}

Measured memory_bytes: 256
S = input()[::-1]
mod = [i for i in range(10)]
dp = [[0]*13 for _ in range(len(S)+1)]
dp[0][0] = 1
for i in range(len(S)):
    for j in range(13):
        if S[i] == "?":
            for k in range(10):
                dp[i+1][(j+mod[k])%13] += (dp[i][j])%(10**9+7)
        else:
            dp[i+1][(j+mod[int(S[i])])%13] = (dp[i][j])%(10**9+7)
    mod = [(10*x)%13 for x in mod]
print(dp[-1][5]%(10**9+7))

Measured memory_bytes: 61404
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
using Pii = pair<int, int>;
using Pll = pair<ll, ll>;
#define rep(i, begin, n) for (int i = begin; i < n; i++)
#define repe(i, begin, n) for (int i = begin; i <= n; i++)
#define repr(i, begin, n) for (int i = begin; i > begin - n; i--)
#define repre(i, begin, end) for (int i = begin; i >= end; i--)

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

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

const int inf = INT_MAX;
const int MOD = 1000000007;
const long long INF = LLONG_MAX;
const long long MINF = LLONG_MIN;

// -------------------------------------------------------

ll N, A, B;
ll h[101010];
ll htmp[101010];

bool canbeat(ll n) {
  rep(i, 0, N) { htmp[i] = h[i] - B * n; }

  ll damage = A - B;
  ll cnt = 0;
  rep(i, 0, N) {
    if (htmp[i] <= 0) break;
    cnt += (htmp[i] + damage - 1) / damage;
  }
  return cnt <= n;
}

int main() {
  cin >> N >> A >> B;
  rep(i, 0, N) { cin >> h[i]; }
  sort(h, h + N, greater<ll>());

  ll lb = 0;
  ll ub = inf;
  while (ub != lb + 1) {
    ll mid = (lb + ub) / 2;
    if (canbeat(mid)) {
      ub = mid;
    } else {
      lb = mid;
    }
  }

  cout << ub;
}


Measured memory_bytes: 5124
function main(input) {
    input = input.split(" ");
    // line_first = input[0].split(" ");
    // line_second = input[1].split(" ");

    console.log(Math.pow(input[0], 3));
}

//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
main(require('fs').readFileSync('/dev/stdin', 'utf8'));


Measured memory_bytes: 7372