akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define int long long
#define ld long double
#define ri register int
#define il inline
#define mk make_pair
#define pb push_back
#define fi first
#define se second
#define pii pair<int,int>
#define vi vector<int>
#define vii vector<pii>
#define all(x) x.begin(),x.end() 
#define rep(i,a,b) for(ri i=(a);i<=(b);++i)
#define per(i,a,b) for(ri i=(a);i>=(b);--i)
#define ls (x<<1)
#define rs (x<<1|1)
#define mid (l+r>>1)
#define de(x) cout << #x << " = " << x << endl
#define dd() cout << "Out Put!\n"
const int mod= 1e9+7,maxn=1000010;
const double eps = 1e-8,PI = acos(-1.0);
const int inf=0x7f7f7f7f;
using namespace std;
int a[maxn],b[maxn],v[maxn];
string s;
signed main()
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	int t=1;
//	cin >> t;
	while(t--)
	{
		int n;
		cin >> n;
		rep(i,1,n)
			cin >> a[i];
		sort(a+1,a+1+n);
		int l = n-2,p=n-1,ans=a[n];
		while(l>0)
		{
			l--,ans+=a[p];
			if(l>0)
				l--,ans+=a[p--];
		}
		cout << ans << endl;
	}
	return 0;
}

Measured memory_bytes: 5208
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ll long long
#define fi first
#define se second
#define pb push_back
#define rep(i, s, n) for (int i = s; i < n; i++)
#define rrep(i, s, n) for (int i = (n)-1; i >= (s); i--)
#define REP(i,n) for(int i = 0;i < n; i++)
#define all(a) a.begin(),a.end()
typedef pair<int,int>pint;
typedef vector<int>vint;
typedef vector<pint>vpint;
const long long MOD = 1000000007, INF = 1e18;
 
#define endl '\n'
#define IOS() ios_base::sync_with_stdio(0);cin.tie(0)
 
template<class T>inline bool chmax(T& a,T b){if(a<b){a=b;return true;}return false;}
template<class T>inline bool chmin(T& a,T b){if(a>b){a=b;return true;}return false;}
 
template<typename T>vector<T>
make_v(size_t a){return vector<T>(a);}
template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts){
	return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}
 
template<typename T,typename V>
typename enable_if<is_class<T>::value==0>::type
fill_v(T &t,const V &v){t=v;}
 
template<typename T,typename V>
typename enable_if<is_class<T>::value!=0>::type
fill_v(T &t,const V &v){
	for(auto &e:t) fill_v(e,v);
}


int dp[100010][2];

signed main(){
	IOS();
	string s;
	cin>>s;
    dp[0][1]=1;
	int N = s.size();
    rep(i,0,N){
    //最大値に沿っているかを調べる
		if(s[i]=='1'){
			dp[i+1][1] += dp[i][1]*2;
			dp[i+1][0] += dp[i][0]*3;
			dp[i+1][0] += dp[i][1];
		}else{
			dp[i+1][1] += dp[i][1];
			dp[i+1][0] += dp[i][0]*3;
		}
		dp[i+1][1]%=MOD;
		dp[i+1][0]%=MOD;
    }
	//cout<<dp[N][0]<<" "<<dp[N][1]<<endl;
	cout<<(dp[N][0]+dp[N][1])%MOD<<endl;
}

Measured memory_bytes: 2000
#include <iostream>
#include <cstdio>
#include <vector>
#include <map>
#include <string>
#include <set>
#include <stack>
#include <queue>
#include <algorithm>
#include <cmath>
using namespace std;

int main(){
	int n, m;
	// door[id] := id があるときは true を返す.
	// idが存在するかどうかのチェックは door.count(id)
	map<string,bool> door;
	// is_open := ドアが開いているかどうか.
	bool is_open = false;
	cin >> n;
	for(int i = 0 ; i < n ; i++ ){
		string u;
		cin >> u;
		door[u] = true;
	}
	cin >> m;
	for(int i = 0 ; i < m ; i++ ){
		string t;
		cin >> t;
		
		if( door.count(t) ){ // id が存在するとき
			if( is_open ){ // ドアが開いているときは施錠される
				cout << "Closed by " << t << endl;
				is_open = false;
			}else{
				cout << "Opened by " << t << endl;
				is_open = true;
			}
		}else{ // id が存在しないとき
			cout << "Unknown " << t << endl;
		}
	}
}

Measured memory_bytes: 1236
#include <bits/stdc++.h>
using namespace std;
int main(void){
 int A,B;
  cin>>A>>B;
  if(A==B) cout<<"Draw"<<endl;
  else if(A==1) cout<<"Alice"<<endl;
  else if(B==1) cout<<"Bob"<<endl;
  else if(A>B) cout<<"Alice"<<endl;
  else if(A<B) cout<<"Bob"<<endl;
}

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

int main() {

    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    long long ans=0;
    int n;
    cin >> n;
    for (int i = 1; i <= n; i++) {
        for (int j = i; j <= n; j += i) {
            ans += j;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3632
#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;
    vector <tuple <string ,int ,int>> m;
    string s;
    int ss,j;
    rep(i,n){
        cin >> s >> ss;
        ss=-ss;
        j=i+1;
        m.push_back(tie(s,ss,j));
    }

    sort(m.begin(),m.end());

    rep(i,n){
        cout << get<2>(m[i]) << endl;
    }
    

    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<queue>
#include<utility>
#include<algorithm>
#include<cctype>
using namespace std;


int main(){

	string str;
	bool a=false,b=false,c=false,d=false;

	
	cin >> str;
  if( str.size() >= 6 ) a = true;
  for(int i=0;i<str.size();i++){
    if(isdigit(str[i])) b = true;
    if(islower(str[i])) c = true;
    if(isupper(str[i])) d = true;
  }
  cout << ( a&&b&&c&&d ? "VALID" : "INVALID" ) << endl;


}


Measured memory_bytes: 3208
#define _CRT_SECURE_NO_WARNINGS
#pragma GCC optimize(3)
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma comment(linker, "/stack:200000000")
#include <bits/stdc++.h>
#define rep(i, a, b) for (long long i = a; i <= b; ++i)
#define mp make_pair
#define ll long long
#define SIZE 1005
using namespace std;
void io() { ios::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); }
ll k;
set<string> st;

int main() {
	io(); cin >> k;
	queue<string> q;
	rep(i, 1, 9) q.push(to_string(i));
	vector<ll> vec;
	while (st.size() <= 2e5) {
		string top = q.front();
		q.pop();
		st.insert(top);
		if (top.back() != '9' && top.back() != '0') {
			char ch = top.back(); --ch;
			q.push(top + ch);
			q.push(top + top.back());
			ch += 2;
			q.push(top + ch);
		}
		else if (top.back() == '0') {
			char ch = top.back(); ++ch;
			q.push(top + top.back());
			q.push(top + ch);
		}
		else {
			char ch = top.back(); --ch;
			q.push(top + ch);
			q.push(top + top.back());
		}
	}
	for (auto i : st) vec.emplace_back((ll)stoll(i));
	sort(vec.begin(), vec.end());
	cout << vec[k - 1];
}

Measured memory_bytes: 51156
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;

public class Main {

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

		List<Integer> abcList = new ArrayList<Integer>();
		abcList.add(sc.nextInt());
		abcList.add(sc.nextInt());
		abcList.add(sc.nextInt());

		Collections.sort(abcList);

		int S = 0;
		for (Integer i : abcList) {
			S += i;
		}
		int M = abcList.get(abcList.size() - 1 );
		int C = 0;
		while (true) {
			if (S == (3 * M)) {
				break;
			}
			if ((S % 2) != ((3 * M) % 2)) {
				M ++;
			}
			S += 2;
			C++;
		}
		System.out.println(C);
	}

}


Measured memory_bytes: 21844
from operator import itemgetter

n, m = [int(i) for i in input().split()]
a = sorted([int(i) for i in input().split()])
#print(a)

bc = []
for _ in range(m):
  bc.append([int(i) for i in input().split()])
bc = sorted(bc, key=itemgetter(1), reverse=True)
#print(bc)

change = []
for b,c in bc:
  len_change = len(change)
  b_up = b
  if n - len_change < b:
    b_up = n - len_change
  #print(b_up)
  change += [c]*b_up
  if b_up != b:
    break
change += [0]*(n-len(change))

ans = 0
for i in range(n):
  #print(ans)
  #print(i)
  if a[i] < change[i]:
    ans += change[i]
  else:
    ans += sum(a[i:])
    break
    
print(ans)

Measured memory_bytes: 27852
import java.util.*;
import java.io.*;
import java.awt.geom.*;
import java.math.*;

public class Main {

	static final Scanner in = new Scanner(System.in);
	static final PrintWriter out = new PrintWriter(System.out,false);
	static boolean debug = false;

	static boolean solve() {
		int d = in.nextInt();
		int e = in.nextInt();
		if (d + e == 0) return false;

		double min = 1<<29;
		for (int i=0; i<=d; i++) {
			int j = d - i;
			min = Math.min(min, Math.abs(e - Math.sqrt(i*i + j*j)));
		}

		out.printf("%.5f\n", min);

		return true;
	}

	public static void main(String[] args) {
		debug = args.length > 0;
		long start = System.nanoTime();

		while(solve());
		out.flush();

		long end = System.nanoTime();
		dump((end - start) / 1000000 + " ms");
		in.close();
		out.close();
	}

	static void dump(Object... o) { if (debug) System.err.println(Arrays.deepToString(o)); }
}

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

using namespace std;

int main()
{
  int n,x;
  cin >> n >> x  ;
  int a[n] ;  
  for(int i=0;i<n;i++)
    cin >> a[i] ;
  
  sort(a,a+n) ; //increase
  
  int ans = 0;
  for(int i=0;i<n;++i){
    x-= a[i];
    if(x<0) break;
    ans++;
  }
  if(x<=0)
   cout << ans << endl ;
  else
   cout << ans-1 << endl ;
    
    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

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

        int n = sc.nextInt();
        int d = sc.nextInt();
        int x = sc.nextInt();

        int cnt = 0;
        for (int i = 0; i < n; i++) {
            int a = sc.nextInt();
            cnt++;
            for (int j = 1; j < d; j++) {
                if (a * j + 1 <= d)
                    cnt++;
                else
                    break;
            }
        }
        
        System.out.print(cnt + x);
    }
}


Measured memory_bytes: 21588
#include<bits/stdc++.h>
using namespace std;
const int maxn=1e5+5;
int a[maxn];
int dp[maxn];
int main()
{
	#ifdef TEST
		freopen("input.txt","r",stdin);
    #endif
	int n,m,T;
	cin>>n;
	for(int i=1;i<=n;i++)scanf("%d",&a[i]);
	for(int i=1;i<=n;i++) dp[i]=1e9+7;
	dp[1]=0;
	for(int i=1;i<=n;i++)
	{
		dp[i+1]=min(dp[i]+abs(a[i]-a[i+1]),dp[i+1]);
		dp[i+2]=min(dp[i]+abs(a[i]-a[i+2]),dp[i+2]);
	}
	cout<<dp[n]<<endl;
	
}



Measured memory_bytes: 1024
#include<cstdio>
#include<algorithm>
using namespace std;
#define ll long long
const int mod=1e9+7;
const int maxn=1005;
char ss[maxn][maxn];
int num[maxn][maxn];
int main()
{
    int n,m;
    scanf("%d%d",&n,&m);
    for(int i=0;i<n;i++)
        scanf("%s",ss[i]);
    num[0][0]=1;
    for(int i=0;i<n;i++)
        for(int j=0;j<m;j++)
        {
            if(ss[i][j]=='#'||(i==0&&j==0)) continue;
            int a=i?num[i-1][j]:0,b=j?num[i][j-1]:0;
            num[i][j]=a+b-(a+b>=mod)*mod;
        }
    printf("%d\n",num[n-1][m-1]);
    return 0;
}


Measured memory_bytes: 6568
import java.util.*;

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

        int N = sc.nextInt();
        int Y = sc.nextInt();

        for (int i=0; i<N+1; i++) {
            for (int j=0; j<N+1-i; j++) {
                if (10000*i + 5000*j + 1000*(N - i - j) == Y) {
                    System.out.println(i + " " + j + " " + (N - i - j));
                    return;
                }
            }
        }
        System.out.println("-1 -1 -1");
    }
}



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

// @author : sam000013

#define int long long
#define PI 3.14159265
#define pb(x) push_back(x)
#define PI 3.14159265
#define all(v) v.begin(), v.end()
#define endl cout<<"\n" 
#define dbg(x) cout<<#x<<" "<<x;endl;
#define bye endl;return
#define uni 1.000000
using namespace std;

const int mod = 1000000007;
// template<typename T>

// void debug(vector<T> x){
//     for(auto e:x){
//         cout<<e<<" ";
//     }
//     cout<<"\n";
// }
/*


*/

vector<int> column(300005, 0);
multiset<int> best;
vector<int> inRow[300005];

void upd(int pos, int delta){
    best.erase(best.find(column[pos]));
    column[pos] += delta;
    best.insert(column[pos]);
}
void solve(){
    int h,w,m;
    cin>>h>>w>>m;

    for(int i=0; i<m; i++){
        column[i] = 0;
        best.insert(0);
    }

    for(int i=0; i<m; i++){
        int x,y;
        cin>>x>>y;
        x--; y--;
        inRow[x].push_back(y);
        upd(y,1);
    }
    
    int ans = 0;
    for(int i=0; i<h; i++){
        int cur = inRow[i].size();
        for(auto x:inRow[i]){
            upd(x, -1);
        }
        
        if(best.size())
        cur += *(best.rbegin());
        // cout<<cur<<" ";
        ans = max(ans, cur);
        for(auto x:inRow[i]){
            upd(x, 1);
        }
    }
    cout<<ans;bye;



}

signed main(){
    ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    int t = 1;
    // cin>>t;
    for(int i=1; i<=t; i++){
        solve();
    }
    return 0;
}


Measured memory_bytes: 35880
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n,x=0,max=0;
	string s;
	cin >> n >> s;
	for(int i=0;i<n;i++){
		if(s[i]=='I'){
			x++;
		}else{
			x--;
		}
		if(max<x){
			max=x;
		}
	}
	cout << max << endl;
}

Measured memory_bytes: 256
import itertools
import math
n = int(input())
towns = []
s = 0
s_list = []
for i in range(n):
    towns.append([int(a) for a in input().split(' ')])
    s_list.append(str(i))
ps = [''.join(p) for p in itertools.permutations(s_list)]

k = 0
for i, p in enumerate(ps):
    p = list(p)  # ['0', '1', '2']
    for j in range(len(p)):
        if j+1 >= n:  # n = 3
            break
        s += math.sqrt(((towns[int(p[j])][0] - towns[int(p[j+1])][0])**2) + ((towns[int(p[j])][1] - towns[int(p[j+1])][1])**2))
    k += 1

print(s / k)


Measured memory_bytes: 6064
#include <iostream>
#include <cstdio>
#include <cmath>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <algorithm>

using namespace std;

int main() {

  string S;
  cin>>S;

  //int dp[100005] = {};
  int gp = 0, pp = 0, p = 0;

  for(int i=0; i<S.size(); i++){
    if(S[i] == 'g'){
      if(pp < gp) pp++, p++;
      else gp++;
    }else{
      if(pp < gp) pp++;
      else gp++, p--;
    }
  }

  cout<<p<<endl;

  return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
#define rep0(i, n) for (long long i = 0; i < (long long)(n); i++)
#define rep1(i,n) for(long long i=1;i<=(long long)(n);i++)
#define all(v) v.begin(),v.end()
typedef long long ll;
#define out(i) cout<<(i)<<endl

int main() {
  int S,h,m,s;
  cin>>S;
  h=S/3600; m=(S%3600)/60; if(m!=0)s=(S%3600)%(m*60); else s=(S%3600)%60;
  cout<<h<<":"<<m<<":"<<s<<endl;
}


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

vector <long long> v[30];

int main(){
	string s, t;
	cin >> s >> t;
	int lens = s.length();
	int lent = t.length();
	for(int i = 0; i < lens; i++){
		v[s[i]-'a'].push_back(i+1);
	}
	
	long long j = 0;
	long long ans = 0;
	//cout << 111 << endl;
	bool flag = true;
	for(int i = 0; i < lent; i++){
		if(v[t[i]-'a'].empty()){
			flag = false;
			break;
		}
		else{
			long long pos2=upper_bound(v[t[i]-'a'].begin(),v[t[i]-'a'].end(),j)-v[t[i]-'a'].begin(); 
			//cout << pos2 << endl;
			if(pos2 == v[t[i]-'a'].size()){
				ans++;
				j = v[t[i]-'a'][0];
			}
			else{
				j = v[t[i]-'a'][pos2];
			}
		}
		
	}
	if(flag) printf("%lld", ans*lens+j);
	else{
		printf("-1");
	}
	return 0;
}


Measured memory_bytes: 1724
//専用ライブラリ
#include <iostream>
#include <iomanip>
#include <istream>
#include <ostream>
#include <sstream>
#include <iterator>
#include <vector>
#include <algorithm>
#include <queue>
#include <deque>
#include <list>
#include <stack>
#include <map>
#include <set>
#include <utility>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <string>
#include <ctime>
#include <cctype>
#include <cstdlib>
using namespace std;
typedef long long int ll;
typedef pair<ll,ll>P;
#define INF 10e12
#define MOD 1000000007
#define rep(i, a, n) for (ll i = a; i < (ll)(n); i++)
#define fi first
#define se second
#define mmax(x,y)(x>y?x:y)
#define mmin(x,y)(x<y?x:y)
#define PI acos(-1.0)
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;}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
int cmp(P a,P b){
        if(a.fi!=b.fi)
        return a.fi>b.fi;
        else
        return a.se<b.se;
}
//---------------------------------------------------------------------------

//---------------------------------------------------------------------------
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    //-------------------------------
    int a[5];
    cin>>a[0]>>a[1]>>a[2]>>a[3]>>a[4];
    int min=INF;
    bool abc=0;
    for(int i=0;i<5;i++){
       if(a[i]%10%10!=0)
       {min=std::min(min,a[i]%10%10);
           abc=1;}
    }
    if(abc==0)
        min=10;
    int sum=0;
    for(int i=0;i<5;i++)
    {
        while(a[i]%10%10!=0)
            a[i]++;
        sum+=a[i];
    }
    sum-=(10-min);
    cout<<sum<<endl;
    return 0;
}


Measured memory_bytes: 256
public class Main {
	public static void main(String[] args) {
		    java.util.Scanner scanner = new java.util.Scanner(System.in);
		    int n = scanner.nextInt();
		    int m = scanner.nextInt();
                    int x = 1900 * m + 100 * (n-m);
                    double p = Math.pow(2, m);
                    int y = (int) p * x;
                    System.out.println(y);
		 } 

}


Measured memory_bytes: 23764
#include<bits/stdc++.h>
#define FOR(i, a, b) for (int i = a; i < b; ++i)
#define rep(N) for (int i = 0; i < N; ++i)
#define Rep(a, b) for (int i = a; i < b; ++i)
#define For(i, N) for (int i = 0; i < N; ++i)
#define all(v) v.begin(), v.end()
#define rev(v) v.rbegin(), v.rend()
#define makei(N) int N; cin >> N;
#define makel(N) ll N; cin >> N;
#define makes(s) string s; cin >> s;
#define maked(d) double d; cin >> d;
#define makev(v, N) vi v(N); rep(N)cin >> v[i];
#define mod 1000000007
#define re return 0
#define distance(x1,y1,x2,y2) sqrt((x1 - x2)*(x1 - x2) + (y1 - y2)*(y1 - y2));

using namespace std;
using ll = long long int;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vll = vector<ll>;
using vb = vector<bool>;
using vvb = vector<vector<bool>>;
using vs = vector<string>;
using pii = pair<int, int>;
using pis = pair<int, string>;
using msi = map<string, int>;

template<typename T>
void say(T s) {
	cout << s << "\n";
}

template<typename T>
void say(vector<T> s) {
	auto itr = s.begin();
	cout << *(itr++);
	while (itr != s.end()) {
		cout << " " << *(itr++);
	}
	cout << "\n";
}

void yn(bool b) {
	if (b)say("Yes");
	else say("No");
}

void YN(bool b) {
	if (b)say("YES");
	else say("NO");
}

template<typename T>
void maxi(T &a, T b) {
	a = max(a, b);
}

template<typename T>
void mini(T &a, T b) {
	a = min(a, b);
}

void exact_say(double x) {
	cout << setprecision(numeric_limits<double>::max_digits10) << x << endl;
}

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

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

int main() {
	makei(n);
	makei(x);
	makev(X, n);
	vi v;
	rep(n) {
		v.push_back(abs(x - X[i]));
	}
	int ans = v[0];
	Rep(1, n) {
		ans = gcd(ans, v[i]);
	}
	say(ans);
}

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

long long nisum(int n){
  long long a=1;
  for(int i=0;i<n;i++){
    a *=2;
  }
  
  return a-1;
}

int main (){
  long long H;
  cin >> H;
  int count=0;
  while(H!=1){
    if(H%2==0){
      H /= 2;
      count ++;
    }
    else{
      H --;
      H /= 2;
      count ++;
    }
  }
  
  count ++;
  cout << nisum(count) << endl;
  
  
}

Measured memory_bytes: 256
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <algorithm>
#include <numeric>
#include <functional>
#include <sstream>
#include <iostream>
#include <iomanip>
#define _USE_MATH_DEFINES
#include <cmath>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <cfloat>
#include <cmath>
#include <ctime>
#include <cassert>
#include <cctype>
#include <cstdio>
#include <cassert>
using namespace std;

#define EPS 1e-12
#define ull unsigned long long
#define ll long long
#define VI vector<ll>
#define PII pair<ll, ll> 
#define VVI vector<vector<ll> >
#define VVVI vector<vector<vector<ll>>>
#define VVVVI vector<vector<vector<vector<ll>>>>
#define REP(i,n) for(ll i=0,_n=(n);(i)<(ll)_n;++i)
#define REPR(i,n) for(ll i=(ll)(n)-1;0<=(i);--i)
#define RANGE(i,a,b) for(ll i=(ll)a,_b=(ll)(b);(i)<_b;++i)
#define RANGER(i,a,b) for(ll i=(ll)(b)-1,_a=(ll)(a);(_a)<=i;--i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
#define ALLR(c) (c).rbegin(), (c).rend()
#define PB push_back
#define MP(a, b) make_pair(a, b)
#define POPCOUNT __builtin_popcount
#define POPCOUNTLL __builtin_popcountll
#define CLEAR(table, v) memset(table, v, sizeof(table));
#define UNIFORM_DOUBLE(a, b) (((b-a)*(double)rand()/RAND_MAX)+a) // [a, b) 
#define UNIFORM_LL(a, b) (ll)UNIFORM_DOUBLE(a, b) // [a, b) 
#define IN(v, lo, hi) ((lo)<=(v) && (v)<(hi))
#define DD(v) cout<<#v<<": "<<v<<endl
#define FI first
#define SE second
template <typename T0, typename T1> std::ostream& operator<<(std::ostream& os, const map<T0, T1>& v) { for( typename map<T0, T1>::const_iterator p = v.begin(); p!=v.end(); p++ ){os << p->first << ": " << p->second << " ";} return os; }
template <typename T0, typename T1> std::ostream& operator<<(std::ostream& os, const pair<T0, T1>& v) { os << v.first << ": " << v.second << " "; return os; }
template <typename T> std::ostream& operator<<(std::ostream& os, const vector<T>& v) { for( int i = 0; i < (int)v.size(); i++ ) { os << v[i] << " "; } return os; }
template <typename T> std::ostream& operator<<(std::ostream& os, const set<T>& v) { vector<T> tmp(v.begin(), v.end()); os << tmp; return os; }
template <typename T> std::ostream& operator<<(std::ostream& os, const deque<T>& v) { vector<T> tmp(v.begin(), v.end()); os << tmp; return os; }
template <typename T> std::ostream& operator<<(std::ostream& os, const vector<vector<T> >& v) { for( int i = 0; i < (int)v.size(); i++ ) { os << v[i] << endl; } return os; }
template<typename T>void maxUpdate(T& a, T b) {a = max(a, b);}
template<typename T>void minUpdate(T& a, T b) {a = min(a, b);}
string YN(bool v) { return v ? "Yes":"No"; }
void uniq(VI& es) { sort(ALL(es)); es.erase(unique(ALL(es)), es.end()); }

#define INF (1LL<<60)

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll N,M;
	while(cin>>N>>M) {
		ll ans=N*M;
		cout<<ans<<endl;
	}
	
	return 0;
}


Measured memory_bytes: 3176
#include<bits/stdc++.h>
using namespace std;
typedef  long long ll;
using vll=vector<ll>;
using vi=vector<int>;

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;}

//pow(llpow,modpow)
template<class T> ll llpow(ll x,T n){ll ans=1;if(x==0)ans=0;while(n){if(n&1)ans*=x;x*=x;n>>=1;}return ans;}
long long modpow(long long a, long long n, long long mod) {long long res = 1;while (n > 0) {if (n & 1) res = res * a % mod;a = a * a % mod;n >>= 1;}return res;}
//最大公約数
template<class T> inline T gcd(T x,T y){if(y==0)return x; else {return gcd(y,x%y);}}
//最小公倍数
template<class T> inline T lcm(T x,T y){return x/gcd(x,y)*y;}
//逆元
long long modinv(long long a, long long m) {long long b = m, u = 1, v = 0;while (b) {long long t = a / b;a -= t * b; swap(a, b);u -= t * v; swap(u, v);}u %= m;if (u < 0) u += m;return u;}

#define rep(i, begin_i, end_i) for (ll i = (ll)begin_i; i < (ll)end_i; i++)

long long INF = 1LL<<60;
int a[30];
int n,q;
bool dfs(int next,int sum,int dest){
    if(next==n){
        if(sum==dest)return true;
        else return false;
    }
    bool res1=dfs(next+1,sum,dest);
    bool res2=dfs(next+1,sum+a[next],dest);
    return res1|res2;
}
int main( ){
    cin>>n;
    rep(i,0,n)cin>>a[i];
    cin>>q;
    rep(i,0,q){
        int dest; cin>>dest;
        if(dfs(0,0,dest))cout<<"yes"<<endl;
        else cout<<"no"<<endl;
    }
    return 0;
}





Measured memory_bytes: 3104
def main():
    s=set()
    for digit in range(16):
        for i in range(1,1000):
            c=i*10**digit+int('9'*digit or 0)
            if c<10**15:
                s.add(c)
    c=sorted(s)
    for i,n in enumerate(c):
        sn=n/sum(map(int,str(n)))
        for m in c[i+1:i+11]:
            sm=m/sum(map(int,str(m)))
            if sm<sn:
                s.remove(n)
                break
    print(*sorted(s)[:int(input())],sep='\n')
main()

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

#define IOS ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);

#define bug( x ,y) cerr << #x << '=' << x<<','<<#y<<'='<< y << '\n' ;


int n ,a,b;


int main(){

	IOS

	cin >> n >> a >>b;

	string s ;

	cin >> s;


	for (int i = 0; i < n; ++i)
	{
		if(s[i]=='a' && (a>0 || b>0) ){

			cout << "Yes" << '\n';
			
			if(a>=0)a--;

            if(a==-1)b--;
            

		}

		else if(s[i] =='b' && b>0){

			cout << "Yes" << '\n';

			if(b>0)b--;

		}

		else{
			cout << "No" << '\n';
		}
	
	}




	
 
}

Measured memory_bytes: 848
#include <iostream>
#include <string>
#include <cmath>
#include <algorithm>

using namespace std;

int main() {
    int n;
    cin >> n;
    int h[20];
    int max_height = 0;
    int hotel = 0;
    for (int i=0; i < n; i++){
        cin >> h[i];
        if (h[i] >= max_height){
            max_height = h[i];
            hotel += 1;
        }
    }
    cout << hotel << endl;
}

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

int main(){
  int N; cin >> N;
  vector<long long> A(N),B(N),C(N);
  long long sum=0;
  for(int i=0; i<N; i++){
    cin >> A[i] >> B[i];
    C[i]=A[i]+B[i];
    sum-=B[i];
  }
  
  sort(C.begin(),C.end(),greater<long long>());
  
  for(int i=0; i<(N+1)/2; i++){
    sum+=C[i*2];
  }
  cout << sum << endl;
}

Measured memory_bytes: 2688
#include <iostream>
#include <string>
using namespace std;
int main()
{
	int a,b,i,ans=0;
	cin >> a >> b;
	for(i=a;i<=b;i++)
	{
		int c,d,e,f;
		c=i/10000;//10000の位
		d=(i/1000)%10;//1000の位
		e=(i/10)%10;//10の位
		f=i%10;//1の位
		if((c==f)&&(d==e))ans++;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<cstdio>
#include<cmath>
using namespace std;

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

int main() {
  int N, X;
  scanf("%d%d", &N, &X);
  int diff[N];
  for (int i=0 ; i<N ; i++) {
    int num;
    scanf("%d", &num);
    diff[i] = abs(num - X);
  }
  
  int res = diff[0];
  for (int i=1 ; i<N ; i++) {
    res = gcd(res, diff[i]);
  }
  
  printf("%d\n", res);
}

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

using namespace std ;
#define int long long int

const int maxn = 1e5 + 5;
const int inf = -1 ;
vector< vector<int> > dp(maxn, vector<int>(3,inf));
vector <int> a(maxn), b(maxn), c(maxn);
int n;

int solve(int i , int j){
    if(i == n ){
        return 0;
    }
    int &ans = dp[i][j];
    if(ans != -1) return ans;
    ans = 0;
    if(j == 0){
        ans = a[i] + max(solve(i+1, 1), solve(i+1,2));
    } else if( j == 1){
        ans = b[i] + max(solve(i+1,0), solve(i+1,2));
    } else {
        ans = c[i] + max(solve(i+1,0), solve(i+1,1));
    }
    return ans;
}


int32_t main(){
   // #ifndef ONLINE_JUDGE
     // freopen("input.txt", "r", stdin);
      // freopen("output.txt", "w", stdout);
    // #endif
    cin >> n ;
    for(int i = 0 ; i < n ; i++ ){
        cin >> a[i] >> b[i] >> c[i];
    }

    int ans = max(solve(0,0), max(solve(0,1), solve(0, 2)));
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 12800
#include<bits/stdc++.h>
using namespace std;
int main(){
  int a,b,c;
  cin>>a>>b>>c;
  int i=0;
  while(a<=b){
    i++;
    b=b-a;
    if(i==c){
      break;
    }
  }
  cout<<i;
}

Measured memory_bytes: 256
import java.util.Scanner;

 
public class Main {
 
	public static void main(String[] args) {
		
		Scanner sc = new Scanner(System.in);
		int n  = sc.nextInt();
		char[] s = sc.next().toCharArray();
		int ans = 0;
		
		for(int i = 0; i < n - 2; i++) {
			if(s[i]=='A' && s[i+1]=='B' && s[i+2]=='C') {
				ans++;
			}
		}
		
		System.out.println(ans);
		sc.close();
	}
	
}

Measured memory_bytes: 35696
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,n) for(int i = a;i < n;i++)
#define INF 1e9
#define fs first
#define sc second
typedef unsigned long long ull;
typedef long long ll;


int main(){
	ll n,cnt = 0;
	cin >> n;
	if(n % 10 == 2)cnt++;
	n /= 10;
	if(n % 10 == 2)cnt++;
	n /= 10;
	if(n % 10 == 2)cnt++;
	n /= 10;
	if(n % 10 == 2)cnt++;
	n /= 10;
	cout << cnt << endl;
	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
 
int main(){
   int a, b, c, d, e, f;
   scanf("%d %d %d\n",&a, &b, &c);
   if (a > b) {
      d=a;
      e=b;
      f=c;
      if (b < c){
         e=c;
         f=b;
      }
      if (d < c){
         d=c;
         e=a;
      }
   }
   if (a < b) {
      d=b;
      e=a;
      f=c;
      if (a < c){
         e=c;
         f=a;
      }
      if (d < c){
         d=c;
         e=b;
      }
   }
   printf("%d %d %d\n",f, e, d);
   return 0;
}
 

Measured memory_bytes: 2708
import numpy as np
p = list(map(int, input().split()))
s, d = list(map(lambda x, y: np.array([x, y]), p[::2], p[1::2]))

ans = ""
for _ in range(2):
  v = d - s
  s = d
  d = s + v.dot([[0,1], [-1,0]])
  ans += " " + " ".join(map(str, d))
print(ans[1:])


Measured memory_bytes: 12504
'use strict';

function Main(input) {
    const k = input;
    let cnt = 0;

    for (let i = 2; i <= k; i += 2) {
        for (let j = 1; j <= k; j += 2) {
            cnt++;
        }
    }
    console.log(cnt);
}
//* この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));


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

int main() {
     string s;
     int ans=0;
     cin >> s;
    for(int i=0;i<s.size();i++){
        if(s[i]=='+'){
            ans++;
        }
        if(s[i]=='-'){
            ans--;
        }
    }
    cout << ans << endl;
return 0;
}

Measured memory_bytes: 256
N = gets.chomp.to_i
# A, B, C = gets.chomp.split.map(&:to_i)
# S = gets.chomp.chars

if N % 2 == 1 # odd
  p 0
else # even
  divider = 10
  ans = 0
  while (divider <= N)
    ans += N/divider
    divider *= 5
  end
  p ans
end


Measured memory_bytes: 1788
import sys
input = sys.stdin.readline

import numpy as np

def main():
    n = int(input())
    odd = 0
    even = 0
    for i in range(1, n + 1):
        if i % 2 == 0:
            odd += 1
        else:
            even += 1

    print(even/n)


if __name__ == '__main__':
    main()


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

using namespace std;

typedef long long int ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

const int INF = 1000000000; //
const ll LINF = (ll) 4000000000000000000; //
const ll MOD = (ll) 1000000007; //
const double PI = 3.1415926535898; //

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep2(i,n) for(int i=1;i<=(int)(n);i++)
#define rep3(i,n) for(int i=0;i<=(int)(n);i++)
#define REP(i,m,n) for(int i=m;i<(int)(n);i++)
#define repll(i,n) for(ll i=0;i<(ll)(n);i++)
#define repll2(i,n) for(ll i=1;i<=(ll)(n);i++)
#define REPLL(i,m,n) for(ll i=m;i<(ll)(n);i++)
#define MP make_pair
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define NP(v) next_permutation(v.begin(),v.end())

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

int main() {
    int n, d, x;
    cin >> n >> d >> x;
    int a[n];
    rep(i, n) cin >> a[i];

    int sum = 0;

    rep(i, n) {
        int j = 1;
        while (j <= d) {
            sum++;
            j += a[i];
        }
    }

    cout << sum + x << endl;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>

using namespace std;

int main() {
    string s;
    cin >> s;
    cout << (s[0] == '+' ? 1 : -1)
        + (s[1] == '+' ? 1 : -1)
        + (s[2] == '+' ? 1 : -1)
        + (s[3] == '+' ? 1 : -1) << endl;
}


Measured memory_bytes: 256
#!/usr/bin/env python
from __future__ import division, print_function

import os
import sys
from io import BytesIO, IOBase

if sys.version_info[0] < 3:
    from __builtin__ import xrange as range
    from future_builtins import ascii, filter, hex, map, oct, zip


def main():
    n, m = map(int, input().split())
    a = [int(i) for i in input().split()]

    print(max(-1, n - sum(a)))


# region fastio

BUFSIZE = 8192


class FastIO(IOBase):
    newlines = 0

    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None

    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()

    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)


class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")


def print(*args, **kwargs):
    """Prints the values to a stream, or to sys.stdout by default."""
    sep, file = kwargs.pop("sep", " "), kwargs.pop("file", sys.stdout)
    at_start = True
    for x in args:
        if not at_start:
            file.write(sep)
        file.write(str(x))
        at_start = False
    file.write(kwargs.pop("end", "\n"))
    if kwargs.pop("flush", False):
        file.flush()


if sys.version_info[0] < 3:
    sys.stdin, sys.stdout = FastIO(sys.stdin), FastIO(sys.stdout)
else:
    sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)

input = lambda: sys.stdin.readline().rstrip("\r\n")

# endregion

if __name__ == "__main__":
    main()


Measured memory_bytes: 86088
#include "bits/stdc++.h"
#include <boost/multi_array.hpp>
#include <boost/optional.hpp>
#include <boost/range/irange.hpp>
#include <boost/range/algorithm.hpp>
#include <boost/range/adaptors.hpp>
#include <boost/operators.hpp>
#include <boost/dynamic_bitset.hpp>

namespace adaptor = boost::adaptors;
using index_t = std::size_t;

void Main()
{
	std::int64_t N;
	std::cin >> N;
	if (N % 2 == 1)
	{
		std::cout << 0 << std::endl;
	}
	else
	{
		std::int64_t x = 0;
		for (std::int64_t i = 10; i <= N; i *= 5)
		{
			x += N / i;
		}
		std::cout << x << std::endl;
	}
}

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

Measured memory_bytes: 256
#include<algorithm>
#include<iostream>
#include<cstring>
#include<string>
#include<vector>
#include<cstdio>
#include<cmath>
#include<set>
#include<map>
using namespace std;
typedef long long ll;
const int MAXN=2e5+5;
int read()
{
    int s=0,f=1;
    char ch=getchar();
    while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
    while(ch>='0'&&ch<='9'){s=s*10+ch-'0';ch=getchar();}
    return s*f;
}
ll num[105];
int main()
{
    int n;
    while(cin>>n)
    {
        memset(num,0,sizeof(num));
        ll ans=0;
        for(int i=1;i<=n;i++)
        {
            int x=i;
            int a=x%10;
            int b=i;
            while(x){b=x%10;x/=10;}
            if(a==0||b==0)continue;
            swap(a,b);
            int id=a*10+b;
            if(num[id]==0)
            {
                num[b*10+a]++;
            }
            else
            {
                ans+=num[id]*2;
                num[b*10+a]++;
            }
            if(a==b)ans++;
        }
        cout<<ans<<endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repr(i, n) for (int i = (n); i >= 0; --i)
#define FOR(i, m, n) for (int i = (m); i < (n); ++i)
#define FORR(i, m, n) for (int i = (m); i >= (n); --i)
#define equals(a, b) (fabs((a) - (b)) < EPS)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
const ll mod = 1000000007;
//const ll mod = 998244353;
const int inf = 1e9 + 10;
const ll INF = 1e18;
const ld EPS = 1e-10;
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
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 (a>b) { a=b; return 1; } return 0; }



int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout << fixed << setprecision(25);

  int x, y;
  cin >> x >> y;

  int ans = 0;
  if (x >= 0) {
    if (abs(x) > abs(y)) {
      ans++;
      x = -x;
    }
  }
  else {
    if (abs(x) < abs(y)) {
      ans++;
      x = -x;
    }
  }
  if (abs(x) < abs(y)) {
    ans += abs(y) - abs(x);
    if (y < 0) ans++;
  }
  else if (abs(x) > abs(y)) {
    ans += abs(x) - abs(y);
    if (y > 0) ans++;
  }
  else {
    if (x != y) ans++;
  }
  cout << ans << '\n';




  
  return 0;
}

Measured memory_bytes: 256
/**
            ▄█▀ ▀█▀ ▄▀▄ █▀ █▄█▄█ ▄▀▄ █▀ ▄█▀
            <⇋⇋⇋⋛∰≓⊂(⌒,_ゝ⌒)⊃≓∰⋛⇋⇋⇋>

    ♔♕♖♗♘♙ ☜❷☞✪ ィℋ६ ≈ ᗫẵℜℵĬŊĞ ✪☜❷☞ ♚♛♜♝♞♟
    ♔♕♖♗♘♙                             ♚♛♜♝♞♟
                ˙·٠•●♥ Ƹ̵̡Ӝ̵̨̄Ʒ ♥●•٠·˙
**/

#include <bits/stdc++.h>

#define sz(s) s.size()
#define pb push_back
#define fr first
#define sc second
#define mk make_pair
#define all(s) s.begin(), s.end()

using namespace std;

const int N = 1e5 + 5;

int fl, sum;
long long dp[ 3 ][ 3 ], nw[ 3 ][ 3 ];
int mod = 998244353;

inline long long pw( int a, int b )
{
    long long res = 1;
    while( b-- )
        res *= a, res %= mod;
    return res % mod;
}

main()
{
    string s;
    cin >> s;
    for( int i = 1; i < sz(s); i++ )
    {
        if( s[i] != s[0] )
        {
            fl = 1;
            break;
        }
    }
    if( !fl )
    {
        puts("1");
        return 0;
    }
    if( sz( s ) == 2 )
    {
        cout << 2;
        return 0;
    }
    fl = 0;
    if( sz( s ) == 3 )
    {
        if( s[0] == s[2] )
            cout << 7;
        else if( s[0] != s[ 1 ] and s[ 0 ] != s[ 2 ] and s[ 1 ] != s[ 2 ] )
            cout << 3;
        else
            cout << 6;
        return 0;
    }

    dp[ 0 ][ 0 ] = 1;
    dp[ 1 ][ 1 ] = 1;
    dp[ 2 ][ 2 ] = 1;

    for( int i = 0; i < sz(s); i++ )
        sum += s[ i ] - 'a';

    sum %= 3;

    fl = 0;
    for( int i = 1; i < sz(s); i++ )
    {
        memset( nw, 0, sizeof( nw ) );
        if( s[i] == s[i - 1] )
            fl = 1;
        for( int j = 0; j < 3; j++ )
            for( int k = 0; k < 3; k++ )
                for( int f = 0; f < 3; f++ )
                    if( k != f )
                    {
                        nw[ ( j + f ) % 3 ][ f ] += dp[ j ][ k ];
                        nw[ ( j + f ) % 3 ][ f ] %= mod;
                    }

        swap( dp, nw );
    }

    long long ans = pw( 3, sz(s) - 1 );

    for( int i = 0; i < 3; i++ )
        ans -= dp[ sum ][ i ];

    ans += ( fl ? 0 : 1 );

    ans %= mod;

    if( ans < 0 ) ans += mod;

    cout << ans;
}







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

int main() {
	
	int n;
	cin >> n;
	if(n == 1){
		cout << "Hello World" << endl;
	}else{
		int a, b;
		cin >> a >> b;
		cout << a + b << endl;
	}
	
	return 0;
}

Measured memory_bytes: 256
S = input()

odd_li = ['R', 'U', 'D']
even_li = ['L', 'U', 'D']

for i in range(len(S)):
    if i%2==0: #偶数
        if not S[i] in odd_li:
            print('No')
            exit()
    else:
        if not S[i] in even_li:
            print('No')
            exit()

print('Yes')


Measured memory_bytes: 2940
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
 
using namespace std;
 
#define PB push_back
#define MP make_pairA
#define REP(i,n) for(int i=0;i<(n);i++)
int main()
{
    long long a,b,k;
    cin>>a>>b>>k;
    if(a>=k){
        cout<<a-k<<" "<<b<<endl;
    }else{
        k-=a;
        if(b>=k){
            cout<<"0 "<<b-k<<endl;
        }else{
            cout<<"0 0"<<endl;
        }
    }
}


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

using namespace std;

int main(){
    string s;
    cin>>s;
    int ans;
    if(s=="SUN")ans=7;
    else if(s[0]=='M')ans=6;
    else if(s=="TUE")ans=5;
    else if(s=="WED")ans=4;
    else if(s=="THU")ans=3;
    else if(s=="FRI")ans=2;
    else if(s=="SAT")ans=1;
    cout<<ans<<endl;
    return 0;
}

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

long long n;
vector<long long> a;
map<long long,long long> mp;

long long solve();

int main(){
    cin >> n;
    a.resize(n);
    for(int i = 0;i < n;++i)cin >> a[i];
    cout << solve() << endl;
    return 0;
}

long long solve(){
    for(int i = 0;i < n;++i){
        long long x = a[i];
        for(long long j = 2;j * j <= a[i];++j)
            if(x % j == 0){
                while(x % j == 0)x /= j;
                mp[j] += a[i];
            }
        if(x > 1)mp[x] += a[i];
    }
    long long ans = 0;
    for(auto now : mp)ans = max(ans,now.second);
    return ans;
}


Measured memory_bytes: 3176
def call(n)
	1.upto(n) do |i|
		x = i
		if x % 3 == 0
			print " #{i}"
			next
		end
		
		while x != 0
			x, r = x.divmod(10)
			if r == 3
				print " #{i}"
				break
			end
		end
	end

	puts
end

call(gets.to_i)

Measured memory_bytes: 8692
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define IOS ios_base::sync_with_stdio(false); cin.tie(0);
#define pb push_back
#define pf push_front
#define PI acos(-1)
#define EPS 1e-5
#define sz(v) ((int)(v).size())
#define all(v) v.begin(),v.end()
#define forn(i, n) for(ll i=0;i<(ll)n;i++)
#define fi first
#define se second
 

int main() {
	int n;
	cin >> n;
	string s;
	cin >> s;
	int cnt = 1;
	char prev = s[0];
	for(int i = 1; i < n; i++) {
		if(s[i] != prev) {
			cnt++;
			prev = s[i];
		}
	}	
	cout << cnt << endl;
	return 0;
}



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

int main() {
    string s ;
    int c = 0;
    while(true){
        cin >> s;
        if(s=="0") break;
        for (int i = 0; i < s.size(); i++) {
            c += s[i] - '0';
        }
        cout << c << endl;
        c = 0;
    }
    return 0;
}



Measured memory_bytes: 3144
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ll long long
int main(){
    int n,m,c;
    int ans = 0;
    cin >> n >> m >> c;
    vector<int> b(m);
    vector<vector<int>>a(n,vector<int>(m));
    rep(i,m) cin >> b[i];
    rep(i,n){
        rep(j,m) cin >> a.at(i).at(j);
    }
    
    rep(i,n){ 
        int ab=0;
        rep(j,m){
            ab += b.at(j) * a.at(i).at(j);
        }
        if(ab + c >0) ans ++;
    }
    cout << ans << endl;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(int i=a;i<b;i++)
#define iter(it,a) for(auto it=a.begin();it!=a.end();it++)
#define mp make_pair
#define pb push_back
#define F first
#define S second
typedef long long ll;
typedef long double ld;
 
int n;
vector<int> edges[100000+10];
bool vis[100000+10];
int val[100000+10];

void dfs(int x){
	vis[x]=1;
	int temp = 0;
	bool c=1;
	iter(it,edges[x]){
		if(!vis[(*it)]){
			dfs((*it));
			temp^=val[(*it)];
			c=0;
		}
	}
	if(c==1){
		val[x]=1;
	}
	val[x]=temp+1;
}

int main(){
    cin.tie(0);ios_base::sync_with_stdio(0);
    cin>>n;
    int x,y;
    rep(i,0,n-1){
    	cin>>x>>y;
    	edges[x].pb(y);
    	edges[y].pb(x);
    }
    dfs(1);
    if(val[1]==1){
    	cout<<"Bob"<<endl;
    }
    else{
    	cout<<"Alice"<<endl;
    }
} 

Measured memory_bytes: 10880
#include <bits/stdc++.h>
#define be(v) (v).begin(),(v).end()
#define pb(q) push_back(q)
typedef long long ll;
using namespace std;
const ll mod=1000000007, INF=(1LL<<60);
#define doublecout(a) cout<<fixed<<setprecision(10)<<a<<endl;

int main() {
    cin.tie(0);
    cout.tie(0);
    ios::sync_with_stdio(false);
    ll n, p;
    cin >> n >> p;
    string s;
    cin >> s;
    if(p == 2LL || p == 5LL){
    	ll num = 0, ans = 0, m;
    	for(int i=n-1;i>=0;i--){
    		m = (s[i] - '0');
    		if(m % p == 0LL){
    			num++;
    		}
    		ans += num;
    	}
    	cout << ans << endl;
    }else{
    	vector<ll> dp(p, 0);
    	dp[0]++;
    	ll num = 0;
    	ll ans = 0, m, t = 1;
    	for(int i=n-1;i>=0;i--){
    		m = (s[i] - '0') * t;
    		m %= p;
    		num += m;
    		num %= p;
    		ans += dp[num];
    		dp[num]++;
    		t *= 10LL;
    		t %= p;
    	}
    	cout << ans << endl;
    }
    return 0;
}


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

mod_four = len([i for i in A if i % 4 == 0])
odd_number = len([i for i in A if i % 2 == 1])

if mod_four >= odd_number:
    print("Yes")
elif mod_four + 1 == odd_number and N - mod_four - odd_number == 0:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 14252
def f(n):
    # 数列の規則
    if n % 2 == 0:
        return int(n / 2)
    else:
        return 3 * n + 1
 
if __name__ == "__main__":
    s = int(input())
    if s == 2 or s == 1:
        print(4)
        exit()
    for m in range(1, 1000000): # m < 1000000となるので
        if s == 4:
            print(m + 3)
            break
        s = f(s)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define zero_pad(num) setfill('0') << std::right << setw(num)
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;

int main() {
    string s;
    cin >> s;
    if(s[0] == s[1] && s[1] == s[2]) cout << "Yes" << endl;
    else if(s[1] == s[2] && s[2] == s[3]) cout << "Yes" << endl;
    else cout << "No" << endl;
    
}

Measured memory_bytes: 256
/*
left-child,right-sibling representation
*/

#include<stdio.h>
#include<stdlib.h>

typedef struct{
	int p;	//parent
	int l;	//left_child
	int r; 	//right_sibling
}Node;

int main(void){
	int now_id,depth_cnt,n,k,c;
	int i,j;
	Node *node;

	scanf("%d",&n);

	node=(Node*)malloc(n*sizeof(Node));

	for(i=0;i<n;i++){
		node[i].p=-1;
		node[i].l=-1;
		node[i].r=-1;
	}

	for(i=0;i<n;i++){
		scanf("%d",&now_id);
		scanf("%d",&k);

		for(j=0;j<k;j++){
			if(j==0){
				 scanf("%d",&c);
				 node[now_id].l=c;
			}
			else{
				 scanf("%d",&node[c].r);
				 c=node[c].r;
			}
			node[c].p=now_id;
		}
	}

	for(i=0;i<n;i++){
		printf("node %d: ",i);
		printf("parent = %d, ",node[i].p);

		depth_cnt=0;
		now_id=i;
		while(node[now_id].p != -1){
			depth_cnt++;
			now_id=node[now_id].p;
		}
		printf("depth = %d, ",depth_cnt);

		if(node[i].p==-1) printf("root, ");
		else if(node[i].l==-1) printf("leaf, ");
		else printf("internal node, ");

		printf("[");
		if(node[i].l!=-1){
			now_id=node[i].l;
			printf("%d",now_id);
			while(node[now_id].r!=-1){
				now_id=node[now_id].r;
				printf(", %d",now_id);
			}
		}
		printf("]\n");
	}

	return 0;
}

Measured memory_bytes: 1788
#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
#include <cmath>
#include <bitset>
#include <iomanip>
#include <stack>
#include <list>
#include <map>
#include <unordered_map>
#include <chrono>
#include <numeric>
using namespace std;
using ll = long long;
const long long INF = (long long)1e18+1;
#define DIV 1000000007
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
#ifdef TEST
    chrono::system_clock::time_point start, end;
    start = chrono::system_clock::now();
#endif
    long idx=0;
    string S;
    cin >> S;
    if(S[2] == S[3] && S[4] == S[5]) cout << "Yes" << endl;
    else cout << "No" << endl;
#ifdef TEST
    end = chrono::system_clock::now();
    cerr << static_cast<double>(chrono::duration_cast<chrono::microseconds>(end - start).count() / 1000.0) << "[ms]" << endl;
#endif
    return 0;
}

Measured memory_bytes: 256
n,m,x,y = gets.strip.split.map(&:to_i)

xx=gets.strip.split.map(&:to_i).max
yy=gets.strip.split.map(&:to_i).min
#pp xx
#pp yy
if xx<yy && x<yy && yy<=y
	puts 'No War'
else
	puts 'War'
end



Measured memory_bytes: 1788