akhauriyash/Code-Regression huggingface dataset:
import java.util.Scanner;
import java.util.Arrays;
public class Main{
	public static void main(String[] args){
        new Main().run();
    }
	public void run(){
		Scanner scan = new Scanner(System.in);
		String[] str = {"2 1 1","1 2 1","1 1 2"};
		while(scan.hasNext()){
			int p = scan.nextInt() + scan.nextInt() + scan.nextInt();
			if(p == 0){
				break;
			}
			int n = scan.nextInt();
			int[][] l = new int[n][4];
			int[] ch = new int[p];
			Arrays.fill(ch,2);
			for(int i = 0;i < n;i++){
				l[i][0] = scan.nextInt() - 1;
				l[i][1] = scan.nextInt() - 1;
				l[i][2] = scan.nextInt() - 1;
				l[i][3] = scan.nextInt();
				if(l[i][3] == 1){
					ch[l[i][0]] = 1;
					ch[l[i][1]] = 1;
					ch[l[i][2]] = 1;
				}
			}
			String t = "";
			for(int i = 0;i < n;i++){
				if(l[i][3] == 1){
					continue;
				}
				t = ch[l[i][0]] + " " + ch[l[i][1]] + " " + ch[l[i][2]];
				for(int j = 0;j < 3;j++){
					if(str[j].equals(t)){
						for(int k = 0;k < 3;k++){
							if(ch[l[i][k]] == 2){
								ch[l[i][k]] = 0;
							}
						}
					}
				}
			}
			for(int i = 0;i < p;i++){
				System.out.println(ch[i]);
			}
		}
	}
}

Measured memory_bytes: 26592
#include <iostream>
#include <iomanip>
#include <cmath>
using namespace std;
int main(){
    int n ;
    while (1){
        cin >> n;
        int a[n] ;
        double m = 0.0, ans = 0;
        if (n == 0) break;
        for (int i = 0; i < n; i++ ){
            cin >> a[i] ;
            m += a[i];
        }
        m = m / n;
        for (int i = 0; i < n; i++){
            ans += pow((a[i] - m),2);
        }
        ans = (sqrt(ans / n));
        cout  << setprecision(10) <<  ans << endl;
    }
}


Measured memory_bytes: 3232
#include<bits/stdc++.h>
using namespace std;
int main(){
  int N;
  cin >> N;
  vector<int> vec(N);
  for(int i=0; i<N; i++){
    cin >> vec.at(i);
  }
  sort(vec.begin(),vec.end());
  int ans = 0;
  int64_t sum = 0;
  for(int i=0; i<N-1; i++){
    sum += vec.at(i);
    if(sum*2 >= vec.at(i+1)){
      ans++;
    }
    else{
      ans = 0;
    }
  }
  cout << ans + 1 << endl;
}

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

using lli = long long int;

template <class T>ostream &operator<<(ostream &o,const vector<T>&v)
{o<<"{";for(int i=0;i<(int)v.size();i++)o<<(i>0?", ":"")<<v[i];o<<"}";return o;}

template <class T>ostream &operator<<(ostream &o,const pair<T, T>&p)
{o<<"("<<p.first<<", "<<p.second<<")";return o;}

int main(void){
    int n, m;
    cin >> n >> m;
    vector<int> a(n), b(n);
    for(int i = 0; i < n; i++){
        cin >> a.at(i);
        cin >> b.at(i);
    }
    vector<pair<int, int>> p(n);
    for(int i = 0; i < n; i++){
        p.at(i).first = a.at(i);
        p.at(i).second = b.at(i);
    }
    sort(p.begin(), p.end());
    priority_queue<lli> q;
    lli res = 0;
    int idx = 0;
    for(int i = 1; i <= m; i++){
        while(idx < n && p.at(idx).first <= i){
            q.push(p.at(idx).second);
            idx++;
        }
        if(!q.empty()){
            res+=q.top();
            q.pop();
        }
    }
    cout << res << endl;
    return 0;
}


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

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

  ll n, m; cin >> n >> m;
  vector<ll> H(n), A(m), B(m);
  for (int i = 0; i < n; i++) cin >> H[i];
  for (int i = 0; i < m; i++) {
    cin >> A[i] >> B[i];
    A[i]--; B[i]--;
  }

  vector<vector<int> > lst(n);
  for (int i = 0; i < m; i++) {
    lst[A[i]].push_back(B[i]);
    lst[B[i]].push_back(A[i]);
  }

  ll ans = 0;
  for (int i = 0; i < n; i++) {
    bool good = true;
    for (int j = 0; j < lst[i].size(); j++) {
      if (H[i] <= H[lst[i][j]]) {
        good = false;
        break;
      }
    }
    if (good) ans++;
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 10592
#include <bits/stdc++.h>
using namespace std;
using LL = long long int;
#define incID(i, l, r) for(int i = (l)    ; i <  (r); ++i)
#define decID(i, l, r) for(int i = (r) - 1; i >= (l); --i)
#define incII(i, l, r) for(int i = (l)    ; i <= (r); ++i)
#define decII(i, l, r) for(int i = (r)    ; i >= (l); --i)
#define inc(i, n)  incID(i, 0, n)
#define dec(i, n)  decID(i, 0, n)
#define inc1(i, n) incII(i, 1, n)
#define dec1(i, n) decII(i, 1, n)
#define inID(v, l, r) ((l) <= (v) && (v) <  (r))
#define inII(v, l, r) ((l) <= (v) && (v) <= (r))
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define FR front()
#define BA back()
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
auto setmin   = [](auto & a, auto b) { return (b <  a ? a = b, true : false); };
auto setmax   = [](auto & a, auto b) { return (b >  a ? a = b, true : false); };
auto setmineq = [](auto & a, auto b) { return (b <= a ? a = b, true : false); };
auto setmaxeq = [](auto & a, auto b) { return (b >= a ? a = b, true : false); };
#define SI(v) static_cast<int>(v.size())
#define RF(e, v) for(auto & e: v)
#define until(e) while(! (e))
#define if_not(e) if(! (e))
#define ef else if
#define UR assert(false)
#define IN(T, ...) T __VA_ARGS__; IN_(__VA_ARGS__);
void IN_() { };
template<typename T, typename ... U> void IN_(T & a, U & ... b) { cin >> a; IN_(b ...); };
template<typename T> void OUT(T && a) { cout << a << endl; }
template<typename T, typename ... U> void OUT(T && a, U && ... b) { cout << a << " "; OUT(b ...); }

// ---- ----

template<typename T> istream & operator>>(istream & s, vector<T> & v) { RF(e, v) { s >> e; } return s; }
template<typename T> ostream & operator<<(ostream & s, vector<T> const & v) {
	inc(i, SI(v)) { s << (i == 0 ? "" : " ") << v[i]; }
	return s;
}

template<typename T> T MV(T v) { return v; }
template<typename T, typename ... U> auto MV(T v, int a, U ... b) { return vector<decltype(MV(v, b ...))>(a, MV(v, b ...)); }

int main() {
	IN(int, n);
	vector<LL> a(n);
	cin >> a;
	LL INF = 1e18;
	auto dp = MV<LL>(-INF, n + 1, 3 + 1);
	dp[0][0] = 0;
	inc(i, n) {
		incII(j, 0, 1 + n % 2) {
			bool f ((i + j) % 2 != 0);
			if(f) {
				setmax(dp[i + 1][j], dp[i][j]);
			} else {
				setmax(dp[i + 1][j], dp[i][j] + a[i]);
				setmax(dp[i + 1][j + 1], dp[i][j]);
			}
		}
	}
	LL ans = -INF;
	incII(j, 0, 1 + n % 2) {
		setmax(ans, dp[n][j]);
	}
	OUT(ans);
}


Measured memory_bytes: 18836
n, m = map(int, input().split())
edges = [list(map(lambda x: int(x) - 1, input().split())) for _ in range(m)]
edges += [[i, i] for i in range(n)]

q = int(input())
color = [0] * (q + 1)
dp = [[0 for j in range(n)] for i in range(11)]
for i in range(q):
    v, d, color[i + 1] = map(int, input().split())
    dp[d][v - 1] = i + 1
 
for i in reversed(range(1, 11)):
    for u, v in edges:
        dp[i - 1][u] = max(dp[i - 1][u], dp[i][v])
        dp[i - 1][v] = max(dp[i - 1][v], dp[i][u])
 
print(*[color[dp[0][i]] for i in range(n)], sep = '\n')

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

bool subsetSum(int A[],int n,int m){
	
	int dp[n+1][m+1];
	memset(dp,0,sizeof(dp));
	
	for(int i=0;i<n;i++){
		int v=A[i];
		for(int j=0;j<=m;j++){
			int t;
			if (j<v) {
				t=dp[i][j];
			} else if (j==v) {
				t=dp[i][j]+1;
			} else {
				t=max(dp[i][j-v],dp[i][j]);
			}
			dp[i+1][j]=t;
		}
	}
	return dp[n][m];
}

int main(){
	int n,q,m,i;
	cin >> n;
	int A[n];
	for(i=0;i<n;i++){
		cin >> A[i];
	}
	cin >> q;
	for(i=0;i<q;i++){
		cin >> m;
		if(subsetSum(A,n,m)){
			cout << "yes" << endl;
		} else {
			cout << "no" << endl;
		}
	}
	return 0;
}



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

int main() {
	int n;

	cin >> n ;

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

	sort(a.begin(), a.end(), greater<int>());

	int alice = 0;
	int bob = 0;

	for (int i = 0; i < n; i++) {
		if (i % 2 == 0) {
			alice += a[i];
		} else {
			bob += a[i];
		}
	}

	cout << alice-bob << endl;
}

Measured memory_bytes: 256
//map_search
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vecll = vector<long long>;
#define all(c) (c).begin(), (c).end()
#define rep(i, n) for (long long i = 0; i < (long long)(n); i++)

int main()
{
    map<string, int> M;
    string key;
    ll q, que, x;

    cin >> q;
    for (int i=0; i< q; i++)
    {
        cin >> que >> key;
        if (!que) //que=0の時,xに入力
            cin >> x;

        if (!que)
            M[key] = x; 
        else if (que)
            cout << M.at(key) << endl;
    }
}


Measured memory_bytes: 27700
s = str(input())

while len(s) >= 0:
  if s[-7:] == 'dreamer':
    s = s[:-7]
  elif s[-6:] == 'eraser':
    s = s[:-6]
  elif s[-5:] == 'dream':
    s = s[:-5]
  elif s[-5:] == 'erase':
    s = s[:-5]
  else:
    break

if len(s) == 0:
  print('YES')
else:
  print('NO')

Measured memory_bytes: 3276
#include <stdio.h>

int main(){
	int input[10][10];
	int i,j,n;
	char c[11];
	
	while(scanf("%s",c)!=EOF){
		for(i=0;i<10;i++){
			input[0][i] = c[i] - '0';
		}
		for(i=1;i<10;i++){
			for(j=0;j<10-i;j++){
				input[i][j] = (input[i-1][j] + input[i-1][j+1]) % 10;
			}
		}
		printf("%d\n",input[9][0]);
		
	}
	
	return 0;
}

Measured memory_bytes: 540
#include<iostream>
#include<string>
#include<vector>
#include<queue>
#include<algorithm>
#include<map>
#include<numeric>
typedef long long ll;

using namespace std;

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

    if(n == m) cout << "Yes" << endl;
    else cout << "No" << endl;

}


Measured memory_bytes: 3524
//  Mayank Agarwal
//  IIIT Hyderabad



#include<bits/stdc++.h>
using namespace std;
const long long int M = 1000000007; 
#define ll long long int
#define ld double
#define pb push_back
#define mp make_pair
ll power(ll x, ll y,  ll p) 
{ 
    ll res = 1;      
    x = x % p;   
    while (y > 0) 
    { 
        if (y & 1) 
            res = (res*x) % p; 
        y = y>>1;x = (x*x) % p; 
    } return res%p; 
} 
ll modinver(ll a,ll b)
{
    return (power(a,1,M)*power(b,M-2,M))%M;
}
void SieveOfEratosthenes(int n) 
{   
    bool prime[10005]; 
    memset(prime, true, sizeof(prime)); 
  
    for (int p=2; p*p<=n; p++) 
    { 
        if (prime[p] == true) 
        { 
            for (int i=p*p; i<=n; i += p) 
                prime[i] = false; 
        } 
    } 
} 
double dp[3001][3002];
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);cout.tie(0);
    ll n;
    cin>>n;
    std::vector<double> v(n);
    for (int i = 0; i < n; ++i)
    {
        cin>>v[i];
    }
    // for (int i = 0; i <=n; ++i)
    // {
    //     for (int j = 0; j <=n; ++j)
    //     {
    //         dp[i][j]=1.0;
    //     }
    // }
    for (int i = 0; i < n; ++i)
    {
        for (int j = 0; j <=n; ++j)
        {
            if(i==0)
            {
                dp[i][0]=1-v[i];
                dp[i][1]=v[i];
            }
            else if(j==0)
            {
                dp[i][j]=dp[i-1][j]*(1-v[i]);
            }
            else
            {
                // cout<<dp[i-1][j-1]*v[i]<<" ";
                dp[i][j]=dp[i-1][j-1]*v[i]+dp[i-1][j]*(1-v[i]);
            }
            // cout<<i<<" "<<j<<" "<<dp[i][j]<<'\n';
        }
    }
    double ans=0;
    for (int i = 0; i <=n; ++i)
    {
        if(i>n-i){
            ans+=dp[n-1][i];
        }
    }
    printf("%.10lf\n",ans );
}


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

//諸機能
#pragma region MACRO 
#define putans(x)  std::cerr << "[ answer ]: " ; cout << (x) << endl
#define dputans(x) std::cerr << "[ answer ]: "; cout << setprecision(40) << (double)(x) << endl
#define REP(i,a,n) for(int i=(a); i<(int)(n); i++)
#define RREP(i,n,a) for(int i=(int)(n-1); i>= a; i--)
#define rep(i,n) REP(i,0,n)
#define rrep(i,n) RREP(i,n,0)
#define all(a) begin((a)),end((a))
#define mp make_pair
#define exist(container, n) ((container).find((n)) != (container).end())
#define equals(a,b) (fabs((a)-(b)) < EPS)
#ifdef _DEBUG //ファイルからテストデータを読み込む
std::ifstream ifs("data.txt");
#define put ifs >>
#else //ジャッジシステムでいい感じにやる
#define put cin >>
#endif
#pragma endregion
//デバッグなどの支援
#pragma region CODING_SUPPORT
#ifdef _DEBUG
#define dbg(var0) { std::cerr << ( #var0 ) << "=" << ( var0 ) << endl; }
#define dbg2(var0, var1) { std::cerr << ( #var0 ) << "=" << ( var0 ) << ", "; dbg(var1); }
#define dbg3(var0, var1, var2) { std::cerr << ( #var0 ) << "=" << ( var0 ) << ", "; dbg2(var1, var2); }
#define dbgArray(a,n) {std::cerr << (#a) << "=";  rep(i,n){std::cerr <<(a[i])<<",";} cerr<<endl;} 
#else
#define dbg(var0) {}
#define dbg2(var0, var1) {}
#define dbg3(var0, var1, var2) {}
#define dbgArray(a,n) {}
#endif 
#pragma endregion 
//typedef（書き換える、書き足す可能性ある）
#pragma region TYPE_DEF
typedef long long ll;
typedef pair<int, int> pii; typedef pair<string, string> pss; typedef pair<int, string>pis;
typedef pair<long long, long long> pll;
typedef vector<string> vs; typedef vector<int> vi;
#pragma endregion
//諸々の定数(書き換える可能性ある)
#pragma region CONST_VAL
#define PI (2*acos(0.0))
#define EPS (1e-10)
#define MOD (ll)(1e9 + 7)
#define INF (ll)(2*1e9)
#pragma endregion


//bitMax そのうち整理する
ll bitMax[100000 + 1];
int n = 100000;
const ll maxInValidValue = 0;//マージで確実に負ける値
ll quaryMax(ll i) {
	ll s = -maxInValidValue;
	while (i > 0) {
		s = max(s, bitMax[i]);//マージ処理 A ∪ B　の計算
		i -= i & -i;
	}
	return s;
}
void setMax(ll i, ll x) {
	while (i <= n) {
		bitMax[i] = max(bitMax[i], x);//マージ処理 A ∪ B　の計算
		i += i & -i;
	}
}

/*
実装例
fill(bit, bit + 100000 + 1, -inValidValue);
setMin(1,4);
setMin(2, 10);
setMin(5, 3);
setMin(6, 1);
rep(i, 8) {
dbg(quary(i+1));　//[1,1] [1,2]...[1,8]の区間で求める
}
*/

/*
実装例
fill(bit, bit + 100000 + 1, -inValidValue);
setMin(1,4);
setMin(2, 10);
setMin(5, 3);
setMin(6, 1);
rep(i, 8) {
dbg(quary(i+1));　//[1,1] [1,2]...[1,8]の区間で求める
}
*/



int main() {
	int nn, t; put nn >> t;
	vi a(nn); rep(i, nn) put a[i];
	t = ( t / 2 ) * 2;//奇数で買い込みすぎると損
	multiset<int> costList;//達成できる最大コスト
	fill(bitMax, bitMax + n, maxInValidValue);
	rep(i, nn) {
		setMax(i+1,a[nn-1-i]);
	}
	int max = 0;
	rep(i, nn-1) {
		dbg2(a[i],quaryMax(nn-i-1));
		int maxCost = quaryMax(nn - i - 1) - a[i];
		if (quaryMax(nn - i - 1) - a[i] < 0) continue;
		costList.insert(maxCost);
		if (max < maxCost)max = maxCost;
	}
	rep(i, nn - 1) {
		if (quaryMax(nn - i - 1) - a[i] == max)dbg2(a[i], quaryMax(nn - i - 1));
	}
	putans(costList.count(max));
END:
	return 0;
}
/*
	double a, b, c; put a >> b >> c;
	dputans(c*b/a);*/

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

using ll = long long;
#define int long long

#define LOG(variable) cout << #variable":\t" << (variable) << endl
#define LOGCON(i, container) for(int (i) = 0; (i) < (container).size(); ++(i)) cout << (i) << ":\t" << (container)[(i)] << endl
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define REPS(i, r, n) for (int i = (r); i < (n); ++i)
#define REPR(i, n) for(int i = (n); i >= 0; --i) // from n to 0
#define REPRS(i, n, r) for(int i = (n); i >= (r); --i) // from n to r
#define REPOBJ(itr, obj) for(auto itr = (obj).begin(); itr != (obj).end() ; ++itr)
#define REPROBJ(itr, obj) for(auto itr = (obj).rbegin(), e = (obj).rend(); itr != e; ++itr)
#define COUTB(x) cout << (x) << "\n"
#define COUTS(x) cout << (x) << " "
#define PB push_back
#define SORT(obj) sort((obj).begin(), (obj).end())
#define SORTR(obj) sort((obj).begin(), (obj).end(), greater<>())
#define ALL(obj) (obj).begin(), (obj).end()
#define MOD 1000000007
#define PI (acos(-1))
using P = pair<int, int>;
int in() {int x; cin>>x; return x;}
string stin() {string s; cin>>s; return s;}
/***** MAIN *****/
signed main() {
  int n = in();
  int k = in();
  vector<P> v(n);
  REP(i,n) {
    int first = in(), second = in();
    v[i] = P(first, second);
  }
  SORT(v);
  int current = 0;
  REP(i,n) {
    current += v[i].second;
    if(current >= k) {
      cout << v[i].first << endl;
      return 0;
    }
  }
  return 0;
}
/***** MAIN *****/


Measured memory_bytes: 1792
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author Gosu_Hiroo
 */

#include <iostream>
#include <fstream>

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

typedef long long ll;
#define tr(container, it) \
        for (auto it = container.begin(); it != container.end(); it++)
#define scontains(c, x) ((c).find(x) != (c).end())   //O(log n)
#define contains(c, x) (find((c).begin(),(c).end(),x) != (c).end()) //O(n)
#define pll pair<ll,ll>
#define pii pair<int,int>
#define mll map<ll,ll>
#define intv(x, a, b)((x)>=a && (x)<=b)
#define  rep(i, _begin, _end) for (__typeof(_end) end = _end, begin = _begin,  i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define  _for(i, end) for (__typeof(end) i = 0, _len = (end); i < (_len); i += 1)
#define all(x) (x).begin(),(x).end()
#define SZ(x) ((int)(x).size())
#define F first
#define S second
#define y0 y3487465
#define y1 y8687969
#define j0 j1347829
#define j1 j234892
#define next asdnext
#define prev asdprev
#define what_is(x) cerr << #x << " is " << x << endl;
#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
#define mod(x, m) ((((x) % (m)) + (m)) % (m))
#define bit(n) (1LL<<(n))
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
#define readint ({int t;cin >> t;t;})
const double PI = 2 * acos(.0);
const int INF = 0x3f3f3f3f;
const ll LLINF = 1000000000000000005LL;;
const ll MOD = (ll) (1e9) + 7;
void _mod(ll &x){x = mod(x, MOD);}
//const ll MOD = (ll) 998244353 ;
const double EPS = 1e-10;
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val) {
    std::fill((T *) array, (T *) (array + N), val);
}


//#define int ll

class DWideFlip {
public:
    string s;
    int N;
    bool ok(int k){
        if(k > N)return 0;
        if(k < N+1-k)return 1;
        int beg = s[N-k];
        what_is(k);
        rep(i,N+1-k, k+1){
//            cerr << s[i-1] << " ";
            if(s[i-1] != beg)return 0;
        }
        return 1;
    }

    void solve(std::istream& cin, std::ostream& cout) {
        cin >> s;
        N = s.size();
        int l = 1, r = N+1;
        while(r - l > 1){
            int mid = (l+r)/2;
            if(ok(mid))l = mid;
            else r = mid;
        }
        cout << l << endl;

    }


};


#undef int
int main() {


	DWideFlip solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	in.tie(0); ios::sync_with_stdio(0); out<<fixed<<setprecision(20);
	solver.solve(in, out);
	return 0;
}


Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n,m;
	cin>>n>>m;
	int a;
	for(int i=0;i<m;i++)
	{
		cin>>a;
		n-=a;
	}
	if(n<0)
	printf("-1");
	else
	cout<<n;
}

Measured memory_bytes: 3660
N = int(input())
A = list(map(int, input().split()))
A.sort()                  #エラトステネスの篩にかけるためソート
Amax = A[-1]
dp = [1]*(Amax+1)         #Aの最大値までのエラトステネスの篩を作る。
ans = 0
for i in range(len(A)-1):
  p = A[i]
  if dp[p] == 1:          #A[i]がA[j]の倍数でないかをエラトステネスの篩でチェック
    for q in range(Amax//p+1):
      dp[p*q] = 0         #A[i]の倍数をすべて0にする
    if A[i] != A[i+1]: 
      ans += 1            #A[i]が重複していなければカウント
if dp[Amax] == 1:         #重複チェック時にレンジオーバーするためAmaxだけ別で判定 
  ans += 1
print(ans)


Measured memory_bytes: 32292
import math
from collections import defaultdict
import itertools
N = int(input())
town = [[int(i) for i in input().split(' ')] for _ in range(N)]

dist = 0
c = 0
for v in itertools.permutations(town,len(town)):
    c += 1
    sx = v[0][0]
    sy = v[0][1]
    for i in v[1::]:
        dist += math.sqrt((sx - i[0]) ** 2 + (sy - i[1]) ** 2)
        sx, sy = i[0], i[1]

print(dist/c)

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

int main(){
int W,H,x,y,r;
    
    
    cin>>W>>H>>x>>y>>r;
    
    
    if(x-r>=0 && x+r<=W && y-r>=0 && y+r <=H){
    
    cout<<"Yes\n";
}else{
    cout<<"No\n";
}
}


Measured memory_bytes: 3088
#include <bits/stdc++.h>
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <vector>

using namespace std;

int A, B, H, M;

double solve() {
    double theta = (H * 60 + M) / (12.0 * 60) * 2 * M_PI;
    double x1 = A * sin(theta), y1 = A * cos(theta);
    double phi = M / 60.0 * 2 * M_PI;
    double x2 = B * sin(phi), y2 = B * cos(phi);
    double x3 = x2 - x1, y3 = y2 - y1;
    return hypot(x3, y3);
}

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

    cin >> A >> B >> H >> M;
    cout << fixed << setprecision(9) << solve() << endl;

    return 0;
}

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

using namespace std;

#define endl '\n'
#define ll long long

int main(){
  ios::sync_with_stdio(0); cin.tie(0); 
  ll n, d;
  cin>>n>>d;
  ll ans=0;
  for(int i=0; i<n; i++){
    ll a,b;
    cin>>a>>b;
    if((a*a)+(b*b)<=(d*d))
        ans++;
      }
  cout<<ans<<endl;
}



Measured memory_bytes: 3644
#include "iostream"
#include "algorithm"
#include "vector"
#include "string"
#include "cmath"
using namespace std;
typedef long long lint;
typedef long double ldouble;

const int IINF = 1e9 + 10;
const lint LLINF = 1e18;
const lint MOD = 1e9 + 7;
const lint inv = 1e9 + 5;

#define REP(i, x, n) for(lint i = x ; i < n ; i++)
#define rep(i, n) REP(i, 0, n)
#define repr(i, n) for(lint i = n - 1 ; i >= 0 ; i--)
#define SORT(c) sort((c).begin(), (c).end())

lint power(lint x, lint n){
    lint t = 1;
    while(n > 0){
        if(n & 1){
            t *= x;
            t %= MOD;
        }
        x *= x;
        x %= MOD;
        n >>= 1;
    }
    return t;
}

lint nCr(lint n, lint r){
    r = min(r, n-r);
    lint multiple = 1, divide = 1;
    rep(i, r){
        multiple *= (n - i);
        multiple %= MOD;
        divide *= (i + 1);
        divide %= MOD;
    }
    lint ans = multiple * power(divide, inv);
    ans %= MOD;
    return ans;
}

lint nHr(lint n, lint r){
    return nCr(n + r - 1, r);
}


int main(int argc, char const *argv[]) {

  long long NN, MM;

  std::cin >> NN >> MM;


  // std::cout << nCr(5, 2) << '\n';

  long long M_devine = 2;
  long long ans = 1;

  while (MM > 1) {
    if (MM % M_devine == 0) {
      long long counter_dev = 0;
      while (MM % M_devine == 0) {
        MM /= M_devine;
        counter_dev++;
      }
      ans *= (nCr(NN+counter_dev-1, counter_dev));

      // std::cout << "M_devine:: " << M_devine  << '\n';
      // std::cout << "counter_dev:: " << counter_dev  << '\n';
      // // std::cout << "combsum(NN, counter_dev):: " << combsum(NN, counter_dev)  << '\n';
      // std::cout << "comb(NN+counter_dev-1, counter_dev):: " <<
      // comb(NN+counter_dev-1, counter_dev)  << '\n';

      ans = ans % MOD;

    }
    M_devine ++;
  }

  std::cout << ans % MOD << '\n';

  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
int getRemain(int a, int b)
{
	int last = a - 2 * b;
	if (last < 0) return 0;
	else return last;
}
int main(void)
{
	int a, b;
	if (scanf("%d %d", &a, &b) == 2)
	{
		printf("%d", getRemain(a, b));
	}
}

Measured memory_bytes: 128
#include <iostream>
#include <iomanip>
#include <cassert>

#include <utility>
#include <vector>
#include <limits>
#include <algorithm>
using namespace std;

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

constexpr int INF = numeric_limits<int>::max();

void Main()
{
	string O, E;
	cin >> O >> E;

	rep(i, O.size() + E.size())
	{
		if (i % 2 == 0)
		{
			cout << O[i/2];
		}
		else
		{
			cout << E[i/2];
		}
	}
	cout << endl;
}

int main()
{
	std::cin.tie(nullptr);
	std::ios_base::sync_with_stdio(false);
	std::cout << std::fixed << std::setprecision(15);

	Main();
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define sorted(a) sort(a.begin(), a.end());
typedef long long ll;
const long mod = 1e9 + 7;

int main(void) {
#ifdef DEBUG
  freopen("input.txt", "r", stdin);
#endif

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

  int N;
  cin >> N;
  int num[9] = {111, 222, 333, 444, 555, 666, 777, 888, 999};
  for (int i = 0; i < 9; i++) {
    if (N <= num[i]) {
      cout << num[i] << "\n";
      break;
    }
  }
  return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int a = scanner.nextInt();
        int b = scanner.nextInt();
        int d = a/b;
        int r = a%b;
        double f = (double)a/b;
        //C?¨??????????printf("%d(??´??°)???%f(?°???°)\n()")
        System.out.printf("%d %d %f\n",d,r,f);
    }

}

Measured memory_bytes: 26308
def main():
    import heapq
    from collections import defaultdict

    x, y, z, k, *abc = map(int, open(0).read().split())
    a = abc[:x]
    b = abc[x:x + y]
    c = abc[x + y:]
    d = defaultdict(list)

    a.sort(reverse=True)
    b.sort(reverse=True)
    c.sort(reverse=True)

    h = [(-(a[0] + b[0] + c[0]), 0, 0, 0)]
    heapq.heapify(h)
    ans = []
    for _ in range(k):
        p, i, j, k = heapq.heappop(h)
        ans.append(-p)
        for p, q, r in [(1, 0, 0), (0, 1, 0), (0, 0, 1)]:
            if i + p < x and j + q < y and k + r < z:
                if (j + q, k + r) not in d[i + p]:
                    d[i + p].append((j + q, k + r))
                    v = - (a[i + p] + b[j + q] + c[k + r])
                    heapq.heappush(h, (v, i + p, j + q, k + r))

    print(*ans, sep='\n')


if __name__ == '__main__':
    main()


Measured memory_bytes: 5104
H,W = gets.split.map &:to_i
S = (0...H).map{ gets.chomp.split("") }
Mod = 1e9.to_i+7
dp = (0...H).map{ Array.new(W,0) }
dp[0][0] = 1
(0...H).each{ |i|
  sh = S[i-1]
  si = S[i]
  dph = dp[i-1]
  dpi = dp[i]
  (0...W).each{ |j|
    if i > 0 && sh[j] == "."
      dpi[j] = (dpi[j] + dph[j]) % Mod
    end
    if j > 0 && si[j-1] == "."
      dpi[j] = (dpi[j] + dpi[j-1]) % Mod
    end
  }
}
#p dp
p dp[-1][-1]

Measured memory_bytes: 94716
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
  ll k,s,ans=0;
  cin>>k>>s;
  for(int x=0;x<=k;x++)
    for(int y=0;y<=k;y++)
      if(x+y<=s&&x+y+k>=s) ans++;
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 384
import itertools 

n = int(input())
#shopの営業データ
shopData = []
#得点ドンぐらいとれるか
point = []
for i in range(n):
    shopData.append(list(map(int, input().split())))
for i in range(n):
    point.append(list(map(int, input().split())))
#最大値
data = list(itertools.product(range(2), repeat = 10))
del data[0]
max_point = - (10 ** 9)
for shop in data:
    cand = 0
    for i in range(len(shopData)):
        count = 0
        for j in range(10):
            if shop[j] == 1 and shopData[i][j] == 1:
                count += 1
        cand += point[i][count]
    max_point = max(max_point, cand)
print(max_point)
                


Measured memory_bytes: 3188
#include<bits/stdc++.h>
#define fo(i,j,l) for(int i=j;i<=l;++i)
#define fd(i,j,l) for(int i=j;i>=l;--i)

using namespace std;
typedef long long ll;
const ll N=1e5+7;

int a[N],n;

inline int read()
{
	int o=0; char ch=' ';
	for(;ch<'0'||ch>'9';ch=getchar());
	for(;ch>='0'&&ch<='9';ch=getchar())o=o*10+ch-48;
	return o;
}

inline int gcd(int x,int y)
{return y==0?x:gcd(y,x%y);} 

int solve()
{
	int odd=0,even=0,k;
	fo(i,1,n)(a[i]&1)?++odd:++even;
	if(even&1)return 1;
	if(odd>1)return 0;
	fo(i,1,n)if(a[i]&1){k=i;break;}
	if(a[k]==1)return 0;
	--a[k];
	int g=a[1];
	fo(i,2,n){
		g=gcd(g,a[i]);
		if(g==1)break;
	}
	fo(i,1,n)a[i]=a[i]/g;
	return (1^solve());
}

int main()
{
	n=read();
	fo(i,1,n)a[i]=read();
	if(solve()==1)puts("First");else puts("Second");
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const double pi = acos(-1);
#define FOR(i,a,b) for (ll i=(a),__last_##i=(b);i<__last_##i;i++)
#define RFOR(i,a,b) for (ll i=(b)-1,__last_##i=(a);i>=__last_##i;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define __GET_MACRO3(_1, _2, _3, NAME, ...) NAME
#define rep(...) __GET_MACRO3(__VA_ARGS__, FOR, REP)(__VA_ARGS__)
#define rrep(...) __GET_MACRO3(__VA_ARGS__, RFOR, RREP)(__VA_ARGS__)
template<typename T> ostream& operator<<(ostream& os, const vector<T>& v) {
REP(i,v.size()){if(i)os<<" ";os<<v[i];}return os;}
template<typename T> ostream& operator<<(ostream& os, const vector<vector<T>>& v) {
REP(i,v.size()){if(i)os<<endl;os<<v[i];}return os;}

int main() {
    // Write Your Code Below
    int n; cin >> n;
    vector<ll> dp(n+1);
    dp[0] = 1;
    dp[1] = 1;
    for(int i=2;i<=n;i++){
        dp[i] = dp[i-1] + dp[i-2];
    }
    cout << dp[n] << endl;

}



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

int gcd(int a, int b)
{
  if(b < a){
    int c = a;
    a = b;
    b = c;
  }
  int r;
  while((r = b%a) > 0){
    b = a;
    a = r;
  }
  return a;
}

int main(void)
{
  int N, X;
  scanf("%d%d", &N, &X);
  int g;
  scanf("%d", &g);
  g = g-X;
  if(g < 0) g = -g;
  for(int i = 1; i < N; i++){
    int x;
    scanf("%d", &x);
    x =x -X;
    if(x < 0) x = -x;
    g = gcd(g, x);
  }
  printf("%d\n", g);
  return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
#define pb push_back
#define S second
#define F first

using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
int cnt[10];
int32_t main(){
    for (int i = 0;i < 4;i++){
        int a;
        cin >> a;
        cnt[a]++;
    }
    if (cnt[1] == 1 && cnt[7] == 1 && cnt[9] == 1 && cnt[4] == 1){
        cout << "YES" << endl;
    }else cout << "NO" << endl;
}


Measured memory_bytes: 256
#include<stdio.h>
int solve(int,int);

int n,q;
int N[200],Q[200];
int main(){

  int i,j;
  
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d",&N[i]);
  }
  scanf("%d",&q);
  for(i=0;i<q;i++){
    scanf("%d",&Q[i]);
  }

  for(i=0;i<q;i++){
    for(j=0;j<q;j++){
      if(solve(j,Q[i])==1){
	printf("yes\n");
	break;
      }
      else{
	printf("no\n");
	break;
      }
    }
  } 
  return 0;
}
int solve(int i,int m){

  int res;
  
  if(m==0) return 1;
  if(i>=n) return 0;
  res=solve(i+1,m);
  if(res==1){
    return res;
  }
  res=solve(i+1,m-N[i]);
  if(res==1){
    return res;
  }
}



Measured memory_bytes: 2108
import bisect
n=int(input())
a=[]
lis=[]
for i in range(n):
  inp=int(input())
  a.insert(bisect.bisect_left(a,inp),inp)
ans=0
bef=a[0]
co=0
for i in a[1:]:
  if i!=bef:
    ans+=(co+1)%2
    co=0
    bef=i
  else:
    co+=1
ans+=(co+1)%2
print(ans)

Measured memory_bytes: 13616
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <cmath>
#include <sstream>
#include <iomanip>
using namespace std;
typedef long long int ll;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define yes cout << "yes" << endl
#define NO cout << "NO" << endl
#define No cout << "No" << endl
#define no cout << "no" << endl

const int INF = 1001001001;
const int mod = 1000000007;
#define PI 3.14159265359;

void P(int x) {cout << x << endl;}
void P(long x) {cout << x << endl;}
void P(double x) {cout << x << endl;}
void P(ll x) {cout << x << endl;}
void P(string x) {cout << x << endl;}
void P(char x) {cout << x << endl;}

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


int main() {
  int a, b, c;
  cin >> a >> b >> c;
  if (a == b) P(c);
  else if (a == c) P(b);
  else P(a);

  return 0;
}

Measured memory_bytes: 256
require 'set'

class Hash
  def push(key, value)
    self[key] = [] if self[key] == nil
    self[key].push(value)
  end
end

def get_ints
  gets.split.map(&:to_i)
end

def get_ints_minus_one
  get_ints.map { |x| x - 1 }
end

def get_int
  gets.chomp.to_i
end

X = get_ints

result = 0

X.each.with_index do |x, i|
  n = i+1
  if n != x
    result = n
    break
  end
end

puts result


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

int main() {
  int h, w;
  cin >> h >> w;
  
  string s_prv, s_mid, s_nxt;
  s_prv = "";
  for (int i = 0; i < w; i++){
    s_prv += ".";
  }
  cin >> s_mid;

  for (int i = 0; i < h; i++){
    if (i < h) {
      cin >> s_nxt;
    }
    for (int j = 0; j < w; j++){
      if (s_mid.at(j) == '.') {
        int ans = 0;
        if (j>0) {
          if (s_mid.at(j-1) == '#'){
            ans += 1; }}
        if (j<w-1) {
          if (s_mid.at(j+1) == '#'){
            ans += 1; }}
        if (i>0) {
          if (s_prv.at(j) == '#'){
            ans += 1; }}
        if (i<h-1) {
          if (s_nxt.at(j) == '#'){
            ans += 1; }}
        if (j>0 && i>0) {
          if (s_prv.at(j-1) == '#'){
            ans += 1; }}
        if (j>0 && i<h-1) {
          if (s_nxt.at(j-1) == '#'){
            ans += 1; }}
        if (j<w-1 && i>0) {
          if (s_prv.at(j+1) == '#'){
            ans += 1; }}
        if (j<w-1 && i<h-1) {
          if (s_nxt.at(j+1) == '#'){
            ans += 1; }}
        cout << ans;
      } else {
        cout << '#';
      }
    }
    cout << endl;
    s_prv = s_mid;
    s_mid = s_nxt;
  }
}


Measured memory_bytes: 3636
#include <iostream>
#include <iterator>
#include <algorithm>
#include <vector>

using namespace std;

int main() {
  int N;
  cin >> N;
  vector<int> p(N);
  copy_n(istream_iterator<int>(cin), N, p.begin());
  const char* res = "YES";
  int cnt = 0;
  for (int i = 1; i <= N; ++i) {
    cnt += (p[i - 1] != i);
    if (2 < cnt) {
      res = "NO";
      break;
    }
  }
  cout << res << endl;
  return 0;
}


Measured memory_bytes: 256
#include <cmath>
#include<iostream>
#include<vector>
#include<algorithm>
#include<functional>
#include<queue>
#include<set>
#include<bitset>
#include<iomanip>
#include<stack>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
ll inf = 1000000007;
ll a[2000005];
int main(void) {
	int n;
	cin >> n;
	ll sum = 0;
	for (int i = 0; i < n; i++) {
		cin >> a[i];
		sum += a[i];
	}
	
	ll ans = 0;
	for (int i = 0; i < n; i++) {
		sum -= a[i];
		
		ans += ((sum%inf) * (a[i]%inf));
		ans %= inf;
		
	}
	cout << ans << endl;
	return 0;
}

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

using namespace std;

vector<string> s;


int checkSurroundingSquares(int i, int j){

    int res = 0;
    
    // check boundaries ...

    if (i - 1 >= 0){
        if (s[i - 1][j] == '#'){
            res++;
        }
    }
    if (i + 1 < s.size()){
        if (s[i + 1][j] == '#'){
            res++;
        }
    }


    if (j - 1 >= 0){
        if (s[i][j - 1] == '#'){
            res++;
        }
    }

    if (j + 1 < s[i].size()){
        if (s[i][j + 1] == '#'){
            res++;
        }
    }


    if (i - 1 >= 0 && j - 1 >= 0){
        if (s[i - 1][j - 1] == '#'){
            res++;
        }
    }
    if (i - 1 >= 0 && j + 1 < s[i].size()){
        if (s[i - 1][j + 1] == '#'){
            res++;
        }
    }


    if (i + 1 < s.size() && j + 1 < s[i].size()){
        if (s[i + 1][j + 1] == '#'){
            res++;
        }
    }
    if (i + 1 < s.size() && j - 1 >= 0){
        if (s[i + 1][j - 1] == '#'){
            res++;
        }
    }


    return res;

}


int main(){

    int h, w;
    cin >> h >> w;

    for (int i = 0; i < h; i++){
        string temp;
        cin >> temp;
        s.push_back(temp);
    }
    
    for (int i = 0; i < h; i++){
        for (int j = 0; j < w; j++){
            if (s[i][j] != '#'){
                int res = checkSurroundingSquares(i, j);
                if (res >= 0){
                    s[i][j] = '0' + res;
                }
            } else {
                s[i][j] = '#';
            }
        } 
    }

    for (int i = 0; i < h; i++){
        for (int j = 0; j < w; j++){
            cout << s[i][j];
        } cout << endl;
    }

    return 0;
}

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

#define optimizar_io ios_base::sync_with_stdio(0);cin.tie(0);

using namespace std;

int main(){
	optimizar_io;
	int N;
	cin >> N;
	int data[N+1];
	for (int i = 0; i < N; i++){
		cin >> data[i];
	}
	sort(data, data + N);
	data[N] = 1000000;
	int sol = 0;
	for (int i = 0; i < N - 2; i++){
		int current = 0;
		for (int j = i + 1; j < N - 1; j++){
			current = max(current, j + 1);
			for (; current <= N; current++){
				if (data[current] >= data[i] + data[j]){
					break;
				}
			}
			sol += (current - 1 - j);
		}
	}
	cout << sol << endl;
	return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;
int main ()
{
    int i,j,k,l,a,b ;
    cin>>i;
    cin>>j;
    cin >>k;
    cin>>l;

    if (i>j)
    {
         cout<<j*k+(i-j)*l;
    }
    else
        cout<<i*k;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <cstdio>
#include <cmath>
#include <tuple>
#include <iomanip>
#include <numeric>
#include <unordered_map>
#include <sstream>   
#include<limits.h>
#include<float.h>
#include<list>
#include <array>
#include <complex>
using namespace std;
#define i64  long long
#define int  long long
 
#define I32_MAX 2147483647
#define I64_MAX 9223372036854775807LL
#define I64_MAX2 1223372036854775807LL
#define INF I64_MAX2
#define MOD 1000000007
#define MEM_SIZE 10000
#define DEBUG_OUT true
#define ALL(x) (x).begin(),(x).end()

// int DP[MEM_SIZE][MEM_SIZE] = {0};
// int GMEM[MEM_SIZE][MEM_SIZE] = {0};
template<typename T> void DEBUG(T e){if(DEBUG_OUT == false)return;std::cout << e << std::endl;}
template<typename T> void DEBUG(const std::vector<T>& v){if(DEBUG_OUT == false)return;for(const auto& e : v){ std::cout << e << " "; } std::cout << std::endl;}
template<typename T> void DEBUG(const std::vector<std::vector<T> >& vv){if(DEBUG_OUT == false)return;for(const auto& v : vv){ DEBUG(v); } }
template<class T,class X> void DEBUG(X d, T e){if(DEBUG_OUT == false)return;std::cout <<d<<" ";DEBUG(e);};
template <class T> void corner(bool flg, T hoge) {if (flg) {cout << hoge << endl; exit(0);}}
template< typename T1, typename T2 > inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }
template< typename T1, typename T2 > inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }

//CODE


void solve(void)
{
  int A,B,C,D;
  cin>>A>>B>>C>>D;
  int X = C - A;
  int Y = D - B;
  
  for (int i = 0; i < Y; i++)
  {
    cout<<"U";
  }
  for (int i = 0; i < X; i++)
  {
    cout<<"R";
  }
  for (int i = 0; i < Y; i++)
  {
    cout<<"D";
  }
  for (int i = 0; i < X; i++)
  {
    cout<<"L";
  }
  cout<<"L";
    for (int i = 0; i < Y+1; i++)
  {
    cout<<"U";
  }
  for (int i = 0; i < X+1; i++)
  {
    cout<<"R";
  }
  cout<<"D";
  cout<<"R";
    for (int i = 0; i < Y+1; i++)
  {
    cout<<"D";
  }
  for (int i = 0; i < X+1; i++)
  {
    cout<<"L";
  }
  cout<<"U"<<endl;

  
  
  


  return;
}


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

  std::cout << std::fixed;
  std::cout << std::setprecision(9);
  solve();
  

 
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <queue>
#include <cstdio>
#include <string.h>
#define rep(i,n) for (int i = 0; i < (int)n; i++)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pi;
typedef pair<pi, pi> pp;
typedef pair<ll, ll> pl;
double PI = 3.1415926535897932;
const double EPS = 1e-9;
const ll MOD = 1000000007;
const int inf = 1 << 30;
const ll linf = 1LL << 60;

string s, t;

int main() {
    cin >> s >> t;
    int ans = 0;
    rep(i,3) {
        if (s[i] == t[i]) ans++;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  int N;
  cin >> N;
  bool res = false;
  for (int i = 0; i * 4 <= N; i++){
    for (int j = 0; j * 7 <= N; j++){
      if (4 * i + 7 * j == N) res = true;
    }
  }
  cout << (res ? "Yes" : "No");
}

Measured memory_bytes: 256
/*
    Written by Nitrogens
    Desire for getting accepted!!
*/
#include <cstdio>
#include <ctime>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <iostream>
#include <algorithm>
#include <queue>
#include <map>
#include <bitset>
#include <stack>
#include <set>
#include <vector>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef double db;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
typedef pair <ll, int> pli;
typedef pair <db, db> pdd;

const int maxn = 3e3+5;
const int Mod = 1000000007;
const int INF = 0x3f3f3f3f;
const ll LL_INF = 0x3f3f3f3f3f3f3f3f;
const double e = exp(1);
const db PI = acos(-1);
const db ERR = 1e-10;

#define Se second
#define Fi first
#define pb push_back
#define dbg(x) cout<<#x<<" = "<< (x)<< endl
#define dbg2(x1,x2) cout<<#x1<<" = "<<x1<<" "<<#x2<<" = "<<x2<<endl
#define dbg3(x1,x2,x3) cout<<#x1<<" = "<<x1<<" "<<#x2<<" = "<<x2<<" "<<#x3<<" = "<<x3<<endl

char s[maxn], t[maxn];
ll dp[maxn][maxn];
int flag[maxn][maxn];

void print(int i, int j)
{
    if(i == 0 || j == 0)
        return;
    if(!flag[i][j])
    {
        print(i - 1, j - 1);
        printf("%c", s[i]);
    }
    else if(flag[i][j] == -1)
        print(i, j - 1);
    else
        print(i - 1, j);
}

int main()
{
    //ios::sync_with_stdio(false);
    //freopen("a.txt","r",stdin);
    //freopen("b.txt","w",stdout);

    scanf("%s", s + 1);
    scanf("%s", t + 1);

    int lengths = strlen(s + 1);
    int lengtht = strlen(t + 1);

    //要记录从哪里转移过来
    memset(dp, 0, sizeof(dp));
    for(int i = 1; i <= lengths; i++)
    {
        for(int j = 1; j <= lengtht; j++)
        {
            if(s[i] == t[j])
            {
                dp[i][j] = dp[i - 1][j - 1] + 1;
                flag[i][j] = 0;
            }
            else
            {
                if(dp[i][j - 1] > dp[i - 1][j])
                {
                    flag[i][j] = -1;
                }
                else
                {
                    flag[i][j] = 1;
                }
                dp[i][j] = max(dp[i - 1][j], dp[i][j - 1]);
            }
        }
    }

    print(lengths, lengtht);
    printf("\n");

    //cout << "time: " << (long long)clock() * 1000 / CLOCKS_PER_SEC << " ms" << endl;
    return 0;
}


Measured memory_bytes: 106112
#include <stdio.h>
  
int rot[24][7] = {
    { 0,1,2,3,4,5,6 },{ 0,1,3,5,2,4,6 },{ 0,1,4,2,5,3,6 },{ 0,1,5,4,3,2,6 },
    { 0,2,6,3,4,1,5 },{ 0,2,3,1,6,4,5 },{ 0,2,1,4,3,6,5 },{ 0,2,4,6,1,3,5 },
    { 0,3,1,2,5,6,4 },{ 0,3,2,6,1,5,4 },{ 0,3,5,1,6,2,4 },{ 0,3,6,5,2,1,4 },
    { 0,4,1,5,2,6,3 },{ 0,4,2,1,6,5,3 },{ 0,4,5,6,1,2,3 },{ 0,4,6,2,5,1,3 },
    { 0,5,1,3,4,6,2 },{ 0,5,3,6,1,4,2 },{ 0,5,4,1,6,3,2 },{ 0,5,6,4,3,1,2 },
    { 0,6,2,4,3,5,1 },{ 0,6,3,2,5,4,1 },{ 0,6,5,3,4,2,1 },{ 0,6,4,5,2,3,1 } };
int assign[7];
  
int main()
{
    int i, j;
    int a[7], b[7], dice[7];
  
    for (i = 1; i <= 6; i++) scanf("%d", assign+i);
    for (i = 1; i <= 6; i++) scanf("%d", a+i);
    for (j = 0; j < 24; j++) {
        for (i = 1; i <= 6; i++) dice[i] = rot[j][i];
        for (i = 1; i <= 6; i++) b[i] = assign[dice[i]];
        for (i = 1; ; i++) {
            if (i > 6) { puts("Yes"); return 0; }
            if (a[i] != b[i]) break;
        }
    }
    puts("No");
    return 0;
}


Measured memory_bytes: 2148
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
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; }
//---------------------------------------------------------------------------------------------------
int gcd(int a, int b) { return a ? gcd(b%a, a) : b; }
/*---------------------------------------------------------------------------------------------------
　　　　　　　　　　　 ∧＿∧  
　　　　　 ∧＿∧ 　（´<_｀ ）　 Welcome to My Coding Space!
　　　　 （ ´_ゝ`）　/　 ⌒i     
　　　　／　　　＼　 　  |　|     
　　　 /　　 /￣￣￣￣/　　|  
　 ＿_(__ﾆつ/　    ＿/ .| .|＿＿＿＿  
　 　　　＼/＿＿＿＿/　（u　⊃  
---------------------------------------------------------------------------------------------------*/






int N, ans[20101];
//---------------------------------------------------------------------------------------------------
void _main() {
    cin >> N;

    int x = 2;
    rep(i, 0, N - 1) {
        while (1) {
            if (x % 2 == 0) break;
            if (x % 3 == 0) break;
            x++;
        }
        ans[i] = x;
        x++;
    }

    int sm = 0;
    rep(i, 0, N - 1) sm += ans[i];
    int ng = 1;
    rep(lst, x, 30001) {
        int s = sm + lst;
        int ok = 1;
        ans[N - 1] = lst;
        rep(i, 0, N) if (1 == gcd(s - ans[i], ans[i])) ok = 0;
        if (ok) {
            ng = 0;
            break;
        }
    }

    if (ng) {
        int x = 2;
        rep(i, 0, N - 1) {
            while (1) {
                if (x == 6) {
                    x++;
                    continue;
                }

                if (x % 2 == 0) break;
                if (x % 3 == 0) break;
                x++;
            }
            ans[i] = x;
            x++;
        }

        int sm = 0;
        rep(i, 0, N - 1) sm += ans[i];
        int ng = 1;
        rep(lst, x, 30001) {
            int s = sm + lst;
            int ok = 1;
            ans[N - 1] = lst;
            rep(i, 0, N) if (1 == gcd(s - ans[i], ans[i])) ok = 0;
            if (ok) {
                ng = 0;
                break;
            }
        }

        if (ng) printf("NG!\n");
    }
    rep(i, 0, N) { if (i) printf(" "); printf("%d", ans[i]); } printf("\n");
}

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

typedef long long ll;
const ll INF = (ll)1e18 + 1;
const ll MOD = 1e9 + 7;

void print(){ std::cout << std::endl; }
template <typename Head> void print(Head&& head) { std::cout << head << std::endl; }
template <typename Head, typename... Tail> void print(Head&& head, Tail&&... tail)
{
  std::cout << head << " ";
  print(std::forward<Tail>(tail)...); // or print(tail...);
}
template<typename Iterator> void printVec(Iterator begin, Iterator end)
{
  for (Iterator it = begin; it != end; it++) {
    std::cout << "[" << std::distance(begin, it) << "] " << *it << " ";
    if (std::distance(begin, it) % 20 == 19) { std::cout << std::endl; }
  }
  std::cout << std::endl;
}

ll gcd(ll a, ll b)
{
  while (b > 0) {
    a %= b;
    std::swap(a, b);
  }
  return a;
}

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

int main(int argc, char* argv[])
{
  ll N, M;
  std::cin >> N >> M;

  std::string s, t;
  std::cin >> s >> t;

  ll L = lcm(N, M);
  ll pitch = L / gcd(N, M);
  for (ll i = 0; i < L; i+=pitch) {
    if (i % (L/N) == 0 && i % (L/M) == 0 && s[i/(L/N)] != t[i/(L/M)]) {
      L = -1;
      break;
    }
  }

  print(L);
  return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
#define pb(q) push_back(q)
typedef long long ll;
using namespace std;
const ll mod=1000000007;
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n;
    cin>>n;
    ll a[n];
    cin>>a[0];
    for(int i=1;i<n;i++){
        cin>>a[i];
        if(a[i]==a[i-1]){
            i--;
            n--;
        }
    }    
    vector<vector<ll> > v(200000);
    ll c[n];
    memset(c,-1,sizeof(c));
    for(ll i=0;i<n;i++){
        v[a[i]-1].pb(i);
    }
    for(ll i=0;i<200000;i++){
        ll niko=v[i].size();
        for(ll j=niko-1;j>0;j--){
            c[v[i][j]]=v[i][j-1];
        }
    }
    ll dp[n];
    dp[0]=1;
    for(ll i=1;i<n;i++){
        dp[i]=dp[i-1];
        if(c[i]!=-1){
            dp[i]+=dp[c[i]];
            dp[i]%=mod;
        }
    }
    cout << dp[n-1]<<endl;
    
    return 0;
}



Measured memory_bytes: 15872
#include <stdio.h>

int main() {
int l,r,d,i=1;
scanf("%d %d %d",&l,&r,&d);
int k,cnt=0;
while(1){
    k=d*i;
    if (k>=l && k<=r) cnt++;
    else if(k>r) break;
    i++;
}
printf("%d",cnt);

    return 0;
}

Measured memory_bytes: 1708