akhauriyash/Code-Regression huggingface dataset:
import sys
## io ##
def IS(): return sys.stdin.readline().rstrip()
def II(): return int(IS())
def MII(): return list(map(int, IS().split()))
def MIIZ(): return list(map(lambda x: x-1, MII()))
## dp ##
def DD2(d1,d2,init=0): return [[init]*d2 for _ in range(d1)]
def DD3(d1,d2,d3,init=0): return [DD2(d2,d3,init) for _ in range(d1)]
## math ##
def to_bin(x: int) -> str: return format(x, 'b') # rev => int(res, 2)
def to_oct(x: int) -> str: return format(x, 'o') # rev => int(res, 8)
def to_hex(x: int) -> str: return format(x, 'x') # rev => int(res, 16)
MOD=10**9+7
def divc(x,y) -> int: return -(-x//y)
def divf(x,y) -> int: return x//y
def gcd(x,y):
    while y: x,y = y,x%y
    return x
def lcm(x,y): return x*y//gcd(x,y)
def enumerate_divs(n):
    """Return a tuple list of divisor of n"""
    return [(i,n//i) for i in range(1,int(n**0.5)+1) if n%i==0]
def get_primes(MAX_NUM=10**3):
    """Return a list of prime numbers n or less"""
    is_prime = [True]*(MAX_NUM+1)
    is_prime[0] = is_prime[1] = False
    for i in range(2, int(MAX_NUM**0.5)+1):
        if not is_prime[i]: continue
        for j in range(i*2, MAX_NUM+1, i): is_prime[j] = False
    return [i for i in range(MAX_NUM+1) if is_prime[i]]
def prime_factor(n):
    """Return a list of prime factorization numbers of n"""
    res = []
    for i in range(2,int(n**0.5)+1):
        while n%i==0: res.append(i); n //= i
    if n != 1: res.append(n)
    return res
## libs ##
from itertools import accumulate as acc, combinations as combi, product, combinations_with_replacement as combi_dup
from collections import deque, Counter
from heapq import heapify, heappop, heappush
from bisect import bisect_left
#======================================================#

def main():
    n = II()
    xl = [MII() for _ in range(n)]
    lr_x = [[x-l, x+l] for x, l in xl]
    lr_x.sort(key=lambda x: x[1])
    now = -(10**9)
    cnt = 0
    for l, r in lr_x:
        if now <= l:
            cnt += 1
            now = r
    print(cnt)

if __name__ == '__main__':
    main()

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

int N, T;
int c, t;
vector<pair<int, int>> X;

int main(){
  cin >> N >> T;
  rep(i, N){
    cin >> c >> t;
    X.push_back(make_pair(c, t));
  }

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

  bool flag = true;
  rep(i, N){
    if (X[i].second <= T){
      cout << X[i].first << endl;
      flag = false;
      break;
    }
  }

  if (flag) cout << "TLE" << endl;
}


Measured memory_bytes: 3636
#include "iostream"
#include <string>
using namespace std;
int main()
{
	int n,r=0;
	string s;
	cin >> n >> s;
	for(int i=0;i<n;i++){
		if(s[i] == 'R')r++;
	}
	cout << ((r > n-r)?"Yes":"No") << endl;
	return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <iostream>
#include <algorithm>
#include <utility>
#include <functional>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <stack>
#include <list>
#include <set>
#include <map>
#include <unordered_map>

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
using namespace std;
using ll = long long;
const int INF = (1<<30);
const ll INFL = (1LL<<62);
const int MOD = 1000000007;
template<class T> bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }
template<class T> T lcm(T a, T b) { return a / gcd(a, b) * b; }
template<class T> ll mod_pow(ll a, ll n, T mod) { mod=(ll)mod; ll res=1, p=a%mod; while(n){ if(n&1) res=res*p%mod; p=p*p%mod; n>>=1; } return res; }

int main() {
    while(true){
        int x, y;
        cin >> x >> y;
        if(x == 0 && y == 0) return 0;
        if(x > y) swap(x, y);
        cout << x << " " << y << endl;
    }

    return 0;
}


Measured memory_bytes: 3068
#include<stdio.h>
#include<string.h>
char s[1000];
int len;
int book1[27];
int book2[27];
void see1_book(int a,int b)
{
	int i;
	int shu;
	for(i=0;i<=b;i++)
	{
		shu=s[i]-96;
		book1[shu]=1;
	}
	return;
}
void see2_book(int a,int b)
{
	int i=0;
	int shu;
	for(i=a;i<=len-1;i++)
	{
		shu=s[i]-96;
		book2[shu]=1;
	}
	return;
}
int main()
{
	int N;
	scanf("%d",&N);
	getchar();
	gets(s);
	len=strlen(s);
	int i=0,count=0,j;
	int max=-1;
	for(i;i<=len-2;i++)
	{
		count=0;
		see1_book(0,i);
		see2_book(i+1,len-1);
		for(j=1;j<=26;j++)
		{
			if(book1[j]==1&&book2[j]==1)
			count++;
		}
		for(j=1;j<=26;j++)
		{
			book1[j]=0;
			book2[j]=0;
		}
		if(count>max)
		max=count;
	}
	printf("%d",max);
}

Measured memory_bytes: 128
using System;
using System.Collections.Generic;
class Program
{
    static void Main(string[] args)
    {
        //入力の受け取り
        char[] input = ReadChar();

        //配列→list
        List<char> numList = new List<char>();
        for (int jj = 0; jj < input.Length; jj++)
        {
            numList.Add(input[jj]);
        }

        //隣合う0と1を取り除いてカウントしていく
        int answer = Puyo(numList);

        //回答提出
        Console.WriteLine(answer);

    }

    static int Puyo(List<char> numList)
    {
        int answer = 0;
        for (int ii = 0; ii < numList.Count - 1; ii++)
        {
            if (numList[ii] != numList[ii + 1])
            {
                numList.RemoveAt(ii);
                numList.RemoveAt(ii);
                answer = answer + 2;
                if (ii < 2)
                {
                    ii = -1;
                }
                else
                {
                    ii = ii - 2;
                }
            }
        }

        return answer;
    }

    //読み取り用
    static String Read()
    {
        return Console.ReadLine();
    }

    static int ReadInt()
    {
        return int.Parse(Console.ReadLine());
    }

    static char[] ReadChar()
    {
        return Console.ReadLine().ToCharArray();
    }


}

Measured memory_bytes: 12000
import math
def comb(n, r):
  return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

n, m = [int(i) for i in input().split(" ")]
r = 0
if n > 1:
  r += comb(n, 2)
if m > 1:
  r += comb(m, 2)
print(r)

Measured memory_bytes: 3060
#include "bits/stdc++.h"
using namespace std;
#ifdef _DEBUG
#include "dump.hpp"
#else
#define dump(...)
#endif

//#define int long long
#define rep(i, a, b) for (int i = (a); i < (b); i++)
#define rrep(i, a, b) for (int i = (b)-1; i >= (a); i--)
#define all(c) begin(c), end(c)
const int INF =
    sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = 1e9 + 7;
template <class T>
bool chmax(T &a, const T &b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
template <class T>
bool chmin(T &a, const T &b) {
    if (b < a) {
        a = b;
        return true;
    }
    return false;
}

signed main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int h, w;
    cin >> h >> w;
    vector<string> v(h);
    rep(i, 0, h) cin >> v[i];
    cout << string(w + 2, '#') << endl;
    ;
    rep(i, 0, h) cout << "#" << v[i] << "#" << endl;
    cout << string(w + 2, '#') << endl;
    return 0;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.math.BigInteger;
import java.util.StringTokenizer;

public class Main {
    BigInteger a, b;

    public static void main(String args[]) {
        new Main().run();
    }

    void run() {
        FastReader sc = new FastReader();
        a = new BigInteger(sc.next());
        b = new BigInteger(sc.next());
        solve();
    }

    void solve() {
        int res = a.compareTo(b);
        if (res > 0) {
            System.out.println("GREATER");
        } else if (res < 0) {
            System.out.println("LESS");
        } else {
            System.out.println("EQUAL");
        }
    }

    static class FastReader {
        BufferedReader br;
        StringTokenizer st;

        public FastReader() {
            br = new BufferedReader(new
                    InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreElements())
            {
                try
                {
                    st = new StringTokenizer(br.readLine());
                }
                catch (IOException e)
                {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt()
        {
            return Integer.parseInt(next());
        }

        long nextLong()
        {
            return Long.parseLong(next());
        }

        double nextDouble()
        {
            return Double.parseDouble(next());
        }

        String nextLine() {
            String str = "";
            try
            {
                str = br.readLine();
            }
            catch (IOException e)
            {
                e.printStackTrace();
            }
            return str;
        }
    }
}


Measured memory_bytes: 21332
#include<iostream>
#include<iomanip>
#include<cstdio>
#include<algorithm>
#include<math.h>
#include <string.h>
using namespace std;
int main(){
	int i,j,m,n,a,b;
	while(cin>>n){
		if(n<1200){
			cout<<"ABC"<<endl;
		}else{
			cout<<"ARC"<<endl; 
		}
	} 
	return 0;
}

Measured memory_bytes: 256
def main():
    num = int(input())
    inputlist = [input() for i in range(num)]
    print("AC x ", inputlist.count("AC"))
    print("WA x ", inputlist.count("WA"))
    print("TLE x ", inputlist.count("TLE"))
    print("RE x ", inputlist.count("RE"))


if __name__ == '__main__':
    main()

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

struct StNode
{
  StNode* m_poParnt;
  StNode* m_poLeft;
  StNode* m_poRigt;
  int m_nKey;

  StNode(int nNo) :
    m_poParnt(nullptr), m_poLeft(nullptr), m_poRigt(nullptr), m_nKey(nNo)
  { }
};

void fnPreOrder(StNode* poNode)
{
  if (poNode == nullptr)  return;

  cout << " " << poNode->m_nKey;
  fnPreOrder(poNode->m_poLeft);
  fnPreOrder(poNode->m_poRigt);
}

void fnInOrder(StNode* poNode)
{
  if (poNode == nullptr)  return;

  fnInOrder(poNode->m_poLeft);
  cout << " " << poNode->m_nKey;
  fnInOrder(poNode->m_poRigt);
}

void fnInsert(StNode*& rpoRoot, StNode* poNewNod)
{
  StNode* poParnt = nullptr;
  StNode* poNode = rpoRoot;

  while (poNode != nullptr)
  {
    poParnt = poNode;
    if (poNewNod->m_nKey < poNode->m_nKey)
      poNode = poNode->m_poLeft;
    else
      poNode = poNode->m_poRigt;
  }

  poNewNod->m_poParnt = poParnt;
  if (poParnt == nullptr)
    rpoRoot = poNewNod;
  else if (poNewNod->m_nKey < poParnt->m_nKey)
    poParnt->m_poLeft = poNewNod;
  else
    poParnt->m_poRigt = poNewNod;
}

void fnBinSchTree(StNode*& rpoRoot)
{
  int nMaxSiz;
  cin >> nMaxSiz;

  for (int i = 0; i < nMaxSiz; ++i)
  {
    string sCmd;
    cin >> sCmd;
    if (sCmd[0] == 'i')
    {
      int nNo;
      cin >> nNo;
      StNode* poNewNod = new StNode(nNo);
      fnInsert(rpoRoot, poNewNod);
    }
    if (sCmd[0] == 'p')
    {
      fnInOrder(rpoRoot);
      cout << endl;
      fnPreOrder(rpoRoot);
      cout << endl;
    }
  }
}

void fnPstOrder(StNode* poNode)
{
  if (poNode == nullptr)  return;

  fnPstOrder(poNode->m_poLeft);
  fnPstOrder(poNode->m_poRigt);
  delete poNode;
}

int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  StNode* poRoot = nullptr;

  fnBinSchTree(poRoot);
//fnPstOrder(poRoot);
  return 0;
}

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

ll l1[10];

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll n,x=0,s=30;
    cin>>n;
    ll l1[n+1];
    for(int i=1;i<=n;i++){
        cin>>l1[i];if(l1[i]&1)x++;ll s2=0;
        while(l1[i]>0){
            l1[i]>>=1;s2++;
            if(l1[i]&1)break;
        }
        s=min(s,s2);
    }
    if(x>=1)cout<<0<<endl;
    else cout<<s<<endl;
}


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


#define _USE_MATH_DEFINES_
#define ll long long
#define ld long double
#define Accepted 0
#define pb push_back
#define mp make_pair
#define sz(x) (int)(x.size())
#define every(x) x.begin(),x.end()
#define F first
#define S second
#define For(i,x,y)  for (ll i = x; i <= y; i ++) 
#define FOr(i,x,y)  for (ll i = x; i >= y; i --)
#define SpeedForce ios_base::sync_with_stdio(0), cin.tie(0)
// ROAD to...                                                                                                                                                                                                                Red

using namespace std;

inline bool isvowel (char c) {
	c = tolower(c);
    if (c == 'a' || c == 'e' || c == 'i' || c == 'y' || c == 'o' || c == 'u') return 1;
    return 0;
}

const double eps = 0.000001;
const ld pi = acos(-1);
const int maxn = 1e7 + 9;
const int mod = 1e9 + 7;
const ll MOD = 1e18 + 9;
const ll INF = 1e18 + 123;
const int inf = 2e9 + 11;
const int mxn = 1e6 + 9;
const int N = 6e5 + 123;                                          
const int M = 22;
const int pri = 997;
const int Magic = 2101;

const int dx[] = {-1, 0, 1, 0};
const int dy[] = {0, -1, 0, 1};
 
int n, k;
int a[N], b[N];
int in[N];
int m[N];
int id[N];
set < pair < int, int > > s1, s2;

bool cmp (int x, int y) {
	return b[x] > b[y];
}

int main () {
	cin >> n;
	vector < int > v;
	ll sa = 0, sb = 0;
	For (i, 1, n) {
		cin >> a[i] >> b[i];
		sa += a[i], sb += b[i];
		v.pb(a[i]), v.pb(b[i]);
		if (a[i] > b[i]) swap(a[i], b[i]);
	}
	sort(every(v));
	ll ans = min(sa, sb), sum = 0;
	for (int i = 0; i < n; i ++) {
		sum += v[i];
	}

	For (i, 1, n) {
		ll res = sum;
		int r = n - 1;
		if (b[i] > v[r]) res += b[i] - v[r], r --;
		if (a[i] > v[r]) res += a[i] - v[r], r --;
		ans = min(ans, res);
	}

	cout << ans << '\n';

	return Accepted;
}

// Coded By OB

Measured memory_bytes: 5496
#include <bits/stdc++.h>
using namespace std ;
int main()
{
    double  x , y=0 ;
    cin >> x ;
    for(int i=0 ; i <= x ; i++){
        if(i%2==1)
            y = y + 1 ;
    }
    cout << y / x ;

    return 0 ;
}


Measured memory_bytes: 256
import java.util.*;
class Main{
	public static void main(String[] args){
		Scanner in = new Scanner(System.in);
		int A =Integer.parseInt(in.next());
		int B =Integer.parseInt(in.next());
		int C =Integer.parseInt(in.next());
		int D =Integer.parseInt(in.next());
		if(A+B>C+D)System.out.println("Left");
		else if(A+B<C+D)System.out.println("Right");
		else System.out.println("Balanced");
	}
}

Measured memory_bytes: 23764
#include <bits/stdc++.h>
#include <array>
using namespace std;
using ULL = unsigned long long;
using UL = unsigned;
using LL = long long;
#define rep(i, n) for(UL i = 0; i < (n); i++)

struct Problem {

	UL N, K;
	vector<vector<UL>> E;

	UL Loop(UL s, UL t) {
		vector<UL> V(N);
		UL ans = 0;
		queue<pair<UL, UL>> Q;
		Q.push({ s, K }); Q.push({ t, K });
		while (Q.size()) {
			auto p = Q.front(); Q.pop();
			if (V[p.first]) continue;
			V[p.first] = 1; ans++;
			if (p.second == 0) continue;
			for (UL e : E[p.first]) {
				Q.push({ e, p.second - 1 });
			}
		}
		return ans;
	}

	void Solve() {
		cin >> N >> K;
		E.resize(N);
		rep(i, N - 1) {
			UL a, b; cin >> a >> b; a--; b--;
			E[a].push_back(b);
			E[b].push_back(a);
		}
		UL ans = 0;
		if (K % 2) {
			K /= 2;
			rep(i, N) for (UL e : E[i]) if (i < e) ans = max(ans, Loop(i, e));
		}
		else {
			K /= 2;
			rep(i, N) ans = max(ans, Loop(i, i));
		}
		cout << (N - ans) << endl;
	}


	Problem();
};
int main() {
	unique_ptr<Problem> p(new Problem());
	p->Solve();
	return 0;
}
Problem::Problem() {
	cout << fixed << setprecision(10);
}

Measured memory_bytes: 384
import math

k = int(input())

total = 0
for a in range(1, k+1):
  for b in range(1, k+1):
    if math.gcd(a,b) == 1:
      total += k
    else:
      for c in range(1, k+1):
        total += math.gcd(a,math.gcd(b,c))
    
print(total)

Measured memory_bytes: 9180
#include<iostream>
#include<cmath>
#include<algorithm>
using namespace std;
int main()
{
    int a,b,c,d,e,f;
    while(cin>>a>>b>>c>>d)
    {
        e=min(a,b);
        f=min(c,d);
        cout<<e+f<<endl;
    }
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdlib>
#include <vector>
#include <algorithm>
#include <cstring>
#include <iomanip>
#include <cmath>
#include <tuple>
#include <map>
#include <unordered_map>
using namespace std;
typedef long long ll;

int main(int argc, char *argv[])
{
	int n, i;
	cin >> n;
	vector< pair<int, int> > jobs(n);
	ll time = 0;
	bool answer = true;
	for (i = 0; i < n; i++) 
		cin >> jobs[i].second >> jobs[i].first;
		
	sort(jobs.begin(), jobs.end());
	for (i = 0; i < jobs.size(); i++) {
		time += jobs[i].second;
		if (time > jobs[i].first) {
			answer = false;
			break;
		}
	}

	if (answer)
		cout << "Yes" << endl;
	else
		cout << "No" << endl;
		  
	return 0;
}


Measured memory_bytes: 1920
#include <bits/stdc++.h>
using namespace std;
int main(void){
    
    //*
    string a;
    int acnt = 0, bcnt = 0, ccnt = 0;
    cin >> a ;
    //*/
    
    if(a.at(0) == 'a'){
        acnt++;
    } else if (a.at(0) == 'b'){
        bcnt++;
    } else if (a.at(0) == 'c'){
        ccnt++;
    }
    
    if(a.at(1) == 'a'){
        acnt++;
    } else if (a.at(1) == 'b'){
        bcnt++;
    } else if (a.at(1) == 'c'){
        ccnt++;
    }
    
    if(a.at(2) == 'a'){
        acnt++;
    } else if (a.at(2) == 'b'){
        bcnt++;
    } else if (a.at(2) == 'c'){
        ccnt++;
    }
    
    /*
    vector<int> vec(4);
    cin >> vec.at(0) >> vec.at(1) >> vec.at(2) ;
    
    sort(vec.begin(), vec.end());
    */
    
    //*
    if(acnt == 1 && bcnt == 1 && ccnt == 1 ){
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
    //*/
    
    //cout << min(a, b) + min(c, d) << endl;

    return 0; 
}


Measured memory_bytes: 3564
#include<bits/stdc++.h>
using namespace std;
     
#define ll long long
#define loop(i,a,n) for(ll i=a;i<n;++i)
#define revloop(i,a,b) for(ll i=a;i>=b;--i)
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define INF 1000000000000000000
#define MOD 998244353 

void func()
{
    ll x;
    cin>>x;
    if(x>=400 && x<600){
        cout<<8<<"\n";
    }
    else if(x>=600 && x<800){
        cout<<7<<"\n";
    }
    else if(x>=800 && x<1000){
        cout<<6<<"\n";
    }
    else if(x>=1000 && x<1200){
        cout<<5<<"\n";
    }
    else if(x>=1200 && x<1400){
        cout<<4<<"\n";
    }
    else if(x>=1400 && x<1600){
        cout<<3<<"\n";
    }
    else if(x>=1600 && x<1800){
        cout<<2<<"\n";
    }
    else if(x>=1800 && x<2000){
        cout<<1<<"\n";
    }

    
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
 
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r" , stdin);
    freopen("output.txt", "w" , stdout);
    #endif
 
    ll t=1;
    //cin>>t;
    while(t--)
    {
        func();
    }

}

Measured memory_bytes: 3648
s=list(input())
n=len(s)
k=int(input())
S=s*3
for i in range(n*3-1):
    if S[i]==S[i+1]:S[i+1]="A"
    
A=S[:n].count("A")
B=S[n:n*2].count("A")
C=S[n*2:n*3].count("A")

if s.count(s[0])==n:print(n*k//2)
else:
    if k==1:print(A)
    elif k==2:print(A+B)
    else:print(A+B*(k-2)+C)

Measured memory_bytes: 3064
//
//  main.cpp
//  Study
//
//  Created by 佐々木勇星 on 2020/03/12.
//  Copyright © 2020 佐々木勇星. All rights reserved.
//

#include <iostream>
#include <vector>
#include <cmath>
#include <sstream>
#include <iomanip>

using namespace std;


int main(int argc, const char * argv[]) {
    
    string s;
    cin >> s;
    
    int n = s.size();
    
    for(int i=0; i<n; i++)
    {
        cout << "x";
    }
    
    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main{

	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);

		int n = scan.nextInt();
		int[] a = new int[n];

		int i;

		for(i=0; i<n; i++)
		{
			a[i] = scan.nextInt();
		}

		for(i=n-1; 0<=i; i--)
		{
			if(i == 0) System.out.printf("%d\n", a[i]);
			else System.out.printf("%d ", a[i]);
		}

		scan.close();
	}

}

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

using namespace std;

int i;
int main() {
	int N, ans = 0;
	string S;
	cin >> N >> S;

	for (i = 0; i < N; i++) {
		if (S[i] == '.') {
			ans++;
		}
	}
	vector<int> v(N + 1);
	v[0] = ans;
	for (i = 1; i < N+1; i++) {
		if (S[i-1] == '#') {
			v[i] = v[i - 1] + 1;
		}
		else {
			v[i] = v[i - 1] - 1;
		}
	}
  	sort(v.begin(),v.end());
	cout << v[0] << endl;
}

Measured memory_bytes: 1412
#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <iostream>
#include <math.h>
#include <assert.h>
#include <vector>
#include <queue>
#include <string>
#include <map>
#include <set>

using namespace std;
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
static const double EPS = 1e-9;
static const double PI = acos(-1.0);

#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, s, n) for (int i = (s); i < (int)(n); i++)
#define FOREQ(i, s, n) for (int i = (s); i <= (int)(n); i++)
#define FORIT(it, c) for (__typeof((c).begin())it = (c).begin(); it != (c).end(); it++)
#define MEMSET(v, h) memset((v), h, sizeof(v))

//a x + b y = gcd(a, b)
long long extgcd(long long a, long long b, long long &x, long long &y) {
  long long g = a; x = 1; y = 0;
  if (b != 0) g = extgcd(b, a % b, y, x), y -= (a / b) * x;
  return g;
}

long long InvMod(long long a, long long mod) {
  long long x, y;
  if (extgcd(a, mod, x, y) == 1) { return (x + mod) % mod; }
  return 0;
}

const ll MOD = 1000000007;
ll fact[500000];
ll invFact[500000];
inline ll Combi(ll a, ll b) {
  if (b < 0 || a < b) { return 0; }
  return fact[a] * invFact[a - b] % MOD * invFact[b] % MOD;
}
int main() {
  fact[0] = 1;
  invFact[0] = 1;
  REP(i, 499999) {
    fact[i + 1] = (fact[i] * (i + 1)) % MOD;
    invFact[i + 1] = InvMod(fact[i + 1], MOD);
  }
  ll n, m, k;
  while (scanf("%lld %lld %lld", &n, &m, &k) > 0) {
    ll ans = 0;
    FOREQ(i, 0, k) {
      ll j = k - i;
      ll l = (Combi(n + 2 * i, i) - Combi(n + 2 * i, i - 1) + MOD) % MOD;
      ll r = (Combi(m + 2 * j, j) - Combi(m + 2 * j, j - 1) + MOD) % MOD;
      ll mid = Combi(n + m + 2 * k, n + 2 * i);
      ans = (ans + l * mid % MOD * r) % MOD;
    }
    printf("%lld\n", ans);
  }
}

Measured memory_bytes: 8656
"""
RRR...RWWW...Wの並びに並び変えるのがゴール
"""

N = int(input())
c = input()

nw = 0
nr = 0

for i in c:
    if i == 'W':
        nw += 1
    elif i == 'R':
        nr += 1

lw = 0
rr = 0

for i in range(0, nr):
    if c[i] == 'W':
        lw += 1

for i in range(nr, len(c)):
    if c[i] == 'R':
        rr += 1

print(max(lw, rr))

Measured memory_bytes: 68004
from sys import stdin
N = int(stdin.readline().rstrip())
nums = [int(_) for _ in stdin.readline().rstrip().split()]

def bubble_sort(a, n):
    count = 0
    flag = 1
    while flag:
        flag = 0
        for i in range(N-1, 0, -1):
            if a[i] < a[i-1]:
                a[i], a[i-1] = a[i-1], a[i]
                flag = 1
                count += 1
    return a, count

ret, count = bubble_sort(nums, N)
print(*ret)
print(count)


Measured memory_bytes: 5612
n=int(input())
a=list(map(int,input().split()))
d=[0]*(10**5+1)
sa=set(a)
for i in a:
  d[i]+=1
for j in range(len(d)):
  if d[j]>2 and d[j]%2==0:
    d[j]=2
  elif d[j]>2 and d[j]%2!=0:
    d[j]=1
ni=d.count(2)
if ni%2==0:
  print(len(sa))
else:
  print(len(sa)-1)

Measured memory_bytes: 58476
#include<iostream>
#include <numeric>
#include <algorithm>
#include <cstdlib>
#include <string>
#include <bits/stdc++.h> 
using namespace std;

#define REP(i, a, b) \
for (int i = int(a); i <= int(b); i++) 
\

int main()
{
	string s;
	cin>>s;
	int ca=0,cb=0;
	REP(i,0,2)
	{
		if(s[i]=='A')
			ca++;
		else
			cb++;
	}
	if(ca==3 || cb==3)
		cout<<"No";
	else
		cout<<"Yes";
	
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define all(x) (x).begin(),(x).end()
using namespace std;
const int INF=1145141919,MOD=1e9+7;
const int64_t LINF=8931145141919364364,LMOD=998244353;
// const int dx[]={1,0,-1,0,1,1,-1,-1},dy[]={0,-1,0,1,1,-1,-1,1};

int main(){
    int n; cin>>n;
    int w[n]; rep(i,n) cin>>w[i];
    int sum[n]={};
    sum[0]=w[0];
    int sums=w[0];
    for(int i=1;i<n;i++){
        sums+=w[i];
        sum[i]=sum[i-1]+w[i];
    }
    int ans=INF;
    for(int i=0;i<n;i++){
        ans=min(ans,abs(sums-2*sum[i]));
    }
    cout<<ans<<endl;
    return 0;
}


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

int main(){

  string s;
  char c;
  char d;

  while(true){
    cin >> s;
    if(s == "#") break;

    c = 'A';

    for(int i=0;i<s.size();i++){
      d = c;

      if(s[i] == '1'){
	if(c == 'A') c = 'Y';
	else if(c == 'W') c = 'Y';
	else if(c == 'B') c = 'X';
	else if(c == 'X') c = 'Z';
	else if(c == 'Z') c = 'B';
      }

      else if(s[i] == '0'){
	if(c == 'A') c = 'X';
	else if(c == 'Y') c = 'X';
	else if(c == 'Z') c = 'W';
	else if(c == 'W') c = 'B';
	else if(c == 'B') c = 'Y';
      }

      if(d == c) c = '*';

    }

    if(c == 'B') cout << "Yes" << endl;
    else cout << "No" << endl;

  }
}

Measured memory_bytes: 1180
#define _USE_MATH_DEFINES
#define INF 0x3f3f3f3f

#include <iostream>
#include <cstdio>
#include <sstream>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <queue>
#include <stack>
#include <limits>
#include <map>
#include <string>
#include <cstring>
#include <set>
#include <deque>
#include <bitset>
#include <list>
#include <cctype>
#include <utility>
  
using namespace std;
  
typedef long long ll;
typedef pair <int,char> PC;
typedef pair <int,string> PS;
  
static const double EPS = 1e-8;
  
int tx[] = {0,1,0,-1};
int ty[] = {-1,0,1,0};

PS Cipher(int pos,const string& str);
PS String(int pos,const string& str);
PC Letter(int pos,const string& str);

PS Cipher(int pos,const string& str){
  string res="";
  while(pos < str.size() && str[pos] != ']'){
    PS p = String(pos,str);
    pos = p.first;
    res += p.second;
  }
  return PS(pos,res);
}

PC Letter(int pos,const string& str){
  if(str[pos] == '+'){
    PC p1 = Letter(pos+1,str);
    p1.second = ((p1.second - 'A') + 1) % ('Z' - 'A' + 1) + 'A';
    return p1;
  }
  else if(str[pos] == '-'){
    PC p2 = Letter(pos+1,str);
    p2.second = ((p2.second - 'A') + ('Z' - 'A')) % ('Z' - 'A' + 1) + 'A';
    return p2;
  }
  else if(isalpha(str[pos])){
    return PC(pos+1,str[pos]);
  }
}

PS String(int pos,const string& str){
  if(str[pos] == '['){
    PS p1 = Cipher(pos+1,str);
    reverse(p1.second.begin(),p1.second.end());
    p1.first++;
    return p1;
  }
  else{
    string tmp = "";
    PC p2 = Letter(pos,str);
    tmp += p2.second;
    return PS(p2.first,tmp);
  }
}

string dfs(string str,
           const vector<int>& question_pos,int idx){
  if(idx == question_pos.size()){
    return Cipher(0,str).second;
  }
  string res = string(500,'Z');

  for(char i = 'A'; i <= 'Z'; i++){
    str[question_pos[idx]] = i;
    res = min(res,dfs(str,question_pos,idx+1));
  }
  return res;
}

int main(){
  string str;
  while(cin >> str){
    if(str == ".") break;

    vector<int> question_pos;
    for(int i=0;i<str.size();i++){
      if(str[i] == '?'){
        question_pos.push_back(i);
      }
    }
    cout << dfs(str,question_pos,0) << endl;
  }
}

Measured memory_bytes: 1228
//#include <bits/stdc++.h>
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstdlib>
#include <string>
#include <vector>
#include <map>
#include <queue>

using namespace std;

typedef long long ll;
typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<n;++i)
#define mod (ll)(1e9+7)
#define FIX(a) ((a)%mod+mod)%mod
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define fi first
#define se second
#define pb push_back
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n,x;
    cin >> n >> x;
    vll s(n);
    REP(i,n){
        cin >> s[i];
    }
    sort(rALL(s));
    vvll dp(n+1,vll(x+1,0));
    dp[0][x] = 1;
    REP(i,n){
        REP(j,x+1){
            if(dp[i][j]==0)continue;
            dp[i+1][j%s[i]]=(dp[i+1][j%s[i]]+dp[i][j])%mod;
            dp[i+1][j] = (dp[i+1][j]+(dp[i][j]*(n-1-(ll)i)%mod))%mod;
        }
    }
    ll ans=0;
    REP(i,x+1){
        ans+=dp[n][i]*(ll)i;
        ans%=mod;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 158592
<>;
/^B.*A$/?++$B_A:/^B/?++$B:/A$/?++$A:0,$AB+=s/AB//g for<>;
if($B_A){
	print$AB+($B_A-1)+($A<$B?$A+1:$A>$B?$B+1:$A+$B?$B+1:0),$/
}else{
	print$AB+($A<$B?$A:$B),$/
}


Measured memory_bytes: 2176
#include<stdio.h>

int main(void){
int x,y,tmp;
scanf("%d %d",&x,&y);
while(x!=0||y!=0){
if(x>y){
tmp=x;
x=y;
y=tmp;
}
printf("%d %d\n",x,y);
scanf("%d %d",&x,&y);
}
return 0;
}

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

using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef pair<int, int> Pii;
typedef pair<int, ll> Pil;
typedef pair<ll, ll> Pll;
typedef pair<ll, int> Pli;

#define fi first
#define se second

const ll MOD = 1e9 + 7;
const ll MOD2 = 998244353;
const ll MOD3 = 1812447359;
const ll INF = 1ll << 62;
const double PI = 2 * asin(1);

void yes() {printf("yes\n");}
void no() {printf("no\n");}
void Yes() {printf("Yes\n");}
void No() {printf("No\n");}
void YES() {printf("YES\n");}
void NO() {printf("NO\n");}

int N;
ll X[15], Y[15], P[15], pow3 = 1;
ll DistX[32768][15], DistY[32768][15];
ll ans[16];

int Prepare(){
  cin >> N;
  ll pow2 = 1;
  for (int i = 0; i < N; i++){
    pow2 *= 2; pow3 *= 3;
    cin >> X[i] >> Y[i] >> P[i];
  }
  for (int i = 0; i < pow2; i++){
    for (int j = 0; j < N; j++){
      DistX[i][j] = abs(X[j]);
      DistY[i][j] = abs(Y[j]);
    }

    int num = i;
    for (int j = 0; j < N; j++){
      if (num % 2 == 1){
        for (int k = 0; k < N; k++){
          DistX[i][k] = min(DistX[i][k], abs(X[j] - X[k]));
          DistY[i][k] = min(DistY[i][k], abs(Y[j] - Y[k]));
        }
      }
      num /= 2;
    }
  }
  return 0;
}

int Solve(int turn){
  int pow2 = 1, cnt = N, turnX = 0, turnY = 0;
  for (int i = 0; i < N; i++){
    if (turn % 3 == 0) cnt--;
    if (turn % 3 == 1) turnX += pow2;
    if (turn % 3 == 2) turnY += pow2;
    turn /= 3; pow2 *= 2;
  }

  ll res = 0;
  for (int i = 0; i < N; i++){
    res += min(DistX[turnX][i], DistY[turnY][i]) * P[i];
  }
  ans[cnt] = min(ans[cnt], res);

  return 0;
}

int main(){
  Prepare();
  fill(ans, ans + N + 1, 1e18);
  for (int i = 0; i < pow3; i++) Solve(i);
  
  for (int i = 0; i <= N; i++) cout << ans[i] << endl;

  return 0;
}



Measured memory_bytes: 11252
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define ll long long int
#define ld long double
#define pii 3.14
#define mod (ll)(1e9+7)
#define inf (ll)(1e18)
#define fio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define ordered_set tree<int, null_type, less_equal<int>, rb_tree_tag, tree_order_statistics_node_update>
#define pi pair<int,int>
#define N (ll)(1e5 + 5)

void solve()
{
    ll n,x,t;
    cin>>n>>x>>t;

    ll ans = (n/x)*t;
    if(n%x)
        ans += t;
    cout<<ans;
}

int main()
{
    fio;
    ll tc = 1;
    //cin>>tc;
    while(tc--)
    {
        solve();
    }
}


Measured memory_bytes: 3588
#include<stdio.h>
#include<stdlib.h>
int main(void){
  int n,i,min,max,A;
  int *R;
  while(1){
  scanf("%d",&n);
  if(n>=2 && n<=200000)break;
  }
  R = (int*)malloc(sizeof(int)*n);
  for(i=0 ; i<n ; i++){
    while(1){
      scanf("%d",&R[i]);
      if(R[i]>=1 && R[i]<=1000000000)break;
    }
  }
  min=R[0];
  max=R[1]-min;
  for(i=1 ; i<n ; i++){
    if(max<R[i]-min)max=R[i]-min;
    if(min>R[i])min=R[i];
  }
  printf("%d\n",max);
  free(R);
  return 0;
}


Measured memory_bytes: 2320
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <algorithm>
#include <numeric>
#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 <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 REP(i,n) for(int i=0,_n=(n);(i)<(int)_n;++i)
#define RANGE(i,a,b) for(int i=(int)a,_b=(int)(b);(i)<_b;++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 PRINT1(table, D0) REP(d0, D0) cout<<table[d0]<<" "; cout<<"\n";
#define PRINT2(table, D0, D1) REP(d0, D0) { REP(d1, D1) cout<<table[d0][d1]<<" "; cout<<"\n"; }
#define PRINT3(table, D0, D1, D2) REP(d0, D0) { REP(d1, D1) { REP(d2, D2) cout<<table[d0][d1][d2]<<" "; cout<<"\n"; } cout<<"\n"; }
#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
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 vector<vector<T> >& v) { for( int i = 0; i < (int)v.size(); i++ ) { os << v[i] << endl; } 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; }

#define MOD 1000000007LL
#define INF (1LL<<60)

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll N,M;
	while(cin>>N>>M) {
		VI A(M), B(M);
		REP(i, M) {
			cin>>A[i]>>B[i];
			A[i]--;B[i]--;
		}
		ll ans = 0;
		REP(ei, M) {
			VVI w(N, VI(N, INF));
			REP(i, N) w[i][i] = 0;
			REP(i, M) if(i!=ei) w[A[i]][B[i]] = w[B[i]][A[i]] = 0;
			REP(k, N) REP(i, N) REP(j, N) w[i][j] = min(w[i][j], w[i][k]+w[k][j]);
			bool ok = 1;
			REP(i, N) REP(j, N) if(w[i][j]==INF) ok=0;
			if(!ok) ans++;
		}
		cout<<ans<<endl;
	}
	
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = s; i < (int)(n); i++)
#define chmax(a, b) a = max(a, b)
#define chmin(a, b) a = min(a, b)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

using namespace std;
using ll = long long;
using pii = pair<int, int>;

//const ll INF = 1e18L + 5;
//const int INF = 1e9 + 5;
//const double pi = 3.14159265358979323846;

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

	unordered_map<int, int> mp;
	int s;
	cin >> s;
	int ans = 1;
	while (true) {
		mp[s]++;
		if (mp[s] == 2) {
			cout << ans << endl;
			return 0;
		}
		if (s & 1) {
			s = 3 * s + 1;
		} else {
			s /= 2;
		}
		ans++;
	}
}


Measured memory_bytes: 256
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>

using namespace std;

int main()
{
    int a,b,c,x,y;
    while(~scanf("%d%d%d",&a,&b,&c))
    {
        long long int sum=0,sum1;
        scanf("%d%d",&x,&y);
        if(a+b<=2*c)
            sum=a*x+b*y,sum1=sum+1;
        else
        {
            if(x>=y)
            {
                sum=sum+c*2*y;
                sum=sum+(x-y)*a;
                sum1=sum1+c*2*x;
            }
            else
            {
                sum=sum+c*2*x;
                sum=sum+(y-x)*b;
                sum1=sum1+c*2*y;
            }
        }
        printf("%lld\n",sum<sum1?sum:sum1);
    }
    return 0;
}


Measured memory_bytes: 128
import java.util.Scanner;
class Main{
	public static void main(String[] args){
    	Scanner sc = new Scanner(System.in);
      	int L = sc.nextInt();
      	int R = sc.nextInt();
      	int d = sc.nextInt();
      	int a = R-L;
      	int g = a/d;
      if(L%d != 0 && R%d !=0){
      	System.out.println(g);
      }else{
      	System.out.println(g+1);
      }
    }
}

Measured memory_bytes: 26944
import java.util.Scanner;

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

		int ac = 0;
		int wa = 0;
		int tle = 0;
		int re = 0;

		for (int i = 0; i < n; i++) {
			String s = sc.next();
			switch (s) {
				case "AC":
					ac++;
					break;
				case "WA":
					wa++;
					break;
				case "TLE":
					tle++;
					break;
				case "RE":
					re++;
					break;
			}
		}
		sc.close();

		System.out.println("AC x " + ac);
		System.out.println("WA x " + wa);
		System.out.println("TLE x " + tle);
		System.out.println("RE x " + re);

	}
}


Measured memory_bytes: 49172
#import
#import math
#import numpy as np
#= int(input())
#= input()
N, K = map(int, input().split())
h = list(map(int, input().split()))
#= [input(), input()]

dp = [0] * N

dp[1] = abs(h[1] - h[0])

for i in range(2, N):
    t = [dp[i - 1] + abs(h[i] - h[i - 1])]
    for j in range(2, min(K + 1, i + 1)):
        tt = dp[i - j] + abs(h[i] - h[i - j])
        t.append(tt)

    dp[i] = min(t)

print(dp[-1])

Measured memory_bytes: 84372
#include <iostream>
#include <string>
#include <set>
#include <map>
using namespace std;

map<string, int> M;
set<string> ans;
string s;

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

	int n, i, maxi = 0;

	cin >> n;
	for (i = 1; i <= n; i++)
	{
		cin >> s;
		M[s]++;
        maxi = max(maxi, M[s]);
	}

	for (auto p : M)
        if (p.second == maxi)
			cout << p.first << '\n';
	return 0;
}

Measured memory_bytes: 23808
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0;i<int(N);++i)
#define rep1(i,N) for(int i=1;i<int(N);++i)
#define all(a) (a).begin(),(a).end()		//sort(all(vi S)) sort(all(string S))
#define push_back pb
#define print(v) { cerr<<#v<<": [ "; for(auto _ : v) cerr<<_<<", "; cerr<<"]"<<endl; }

using P = pair<int, int>;		//P.first, P.second
typedef long long ll;
typedef vector<int> vi;
typedef set<int> seti;
typedef vector<string> vs;

const int MOD = 1e9+7;
const int INF = 1e9;

int main() {
	string S;
	cin>>S;
	int cnt = 0;
	rep(i,S.size()-1){
		if(S[i]!=S[i+1])cnt++;
	}
	
	cout<<cnt<<endl;
}

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

#define rep(i, n) rep2(i, 0, n)
#define rep2(i, m, n) for (ll i = m; i < (n); i++)

using ll = long long;
using pii = pair<int, int>;
using Vi = vector<int>;

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

Measured memory_bytes: 3492
def divisor_list(n):
    ret = set()
    i = 1
    while i * i <= n:
        if n % i == 0:
            ret.add(i)
            ret.add(n // i)
        i += 1
    return ret


N = int(input())

ans = 0
for i in range(N+1):
    A = divisor_list(i)
    oddcnt = 0
    for a in A:
        if a % 2 == 1:
            oddcnt += 1
    if oddcnt == 8:
        ans += 1
print(ans)

Measured memory_bytes: 3064
#include <cstdio>

using namespace std;

int d[10010];

int main()
{
    //freopen("file.in", "r" ,stdin);
    //freopen("file.out", "w", stdout);
    int n,x;
    scanf("%d",&n);
    d[0]=1;
    for(int i=1;i<=n;i++)
    {
        scanf("%d",&x);
        for(int j=10000;j>=0;j--)
            d[j+x]|=d[j];
    }
    for(int i=10000;i>=0;i--)
        if(d[i] && i%10)
        {
            printf("%d",i);
            return 0;
        }
    printf("0");
    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;
import java.util.Arrays;
class Main{
    public static void main(String[] args) {
        Scanner scn=new Scanner(System.in);
        int n=scn.nextInt();
        int kind=scn.nextInt();
        int[][] search=new int[n][kind+1];
        for(int i=0;i<n;i++){
        Arrays.fill(search[i],0);
        }

        for(int i=0;i<n;i++){
            int k=scn.nextInt();
            for(int j=0;j<k;j++){
                int x=scn.nextInt();
                search[i][x]++;
            }
        }
        int cnt=0;
        for(int i=0;i<kind+1;i++){
            int flag=1;
            for(int j=0;j<n;j++){
                if(search[j][i]!=1) flag=0;
            }
            if(flag==1) cnt++;
        }
        System.out.println(cnt);
    }
}


Measured memory_bytes: 22356
#include<bits/stdc++.h>
//H:Grid 1

using namespace::std;

const int SIZE = 1e3 + 1,MOD = 1e9 + 7;
int DP[SIZE][SIZE];
char mat[SIZE][SIZE];

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

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

	for(int i = 1;i <= N;i++){
		for(int j = 1;j <= M;j++){
			cin >> mat[i][j];
		}
	}

	DP[0][1] = 1;
	for(int i = 1;i <= N;i++){
		for(int j = 1;j <= M;j++){
			if(mat[i][j] == '.'){
				DP[i][j] = (DP[i - 1][j] + DP[i][j - 1]) % MOD;
			}
		}
	}

	cout << DP[N][M] << '\n';

	return 0;
}


Measured memory_bytes: 5120
//ITP1_5_D
#include<iostream>
using namespace std;

int main()
{	
	int i,x,n;
	cin>>n;
	
	for(i=1;i<=n;i++){
		if(0==i%3)
			cout<<" "<<i;
		else for(x=i;x!=0;x/=10)
		{
			if(3==x%10){
				cout<<" "<<i;
				break;
				}
		}
	}
	cout<<endl;
	return 0;
}

Measured memory_bytes: 1160
#include<stdio.h>

int main(){
    int a[5],t,i,j;
    for(i=0;i<5;i++){
        scanf("%d",&a[i]);
    }
    for(i=0;i<5;i++){
        for(j=i;j<5;j++){
            if(a[i]<a[j]){
                t=a[i];
                a[i]=a[j];
                a[j]=t;
            }
        }
    }

    for(i=0;i<5;i++){
        printf("%d",a[i]);
        if(i!=4)printf(" ");
    }
     printf("\n");
    return 0;
}

Measured memory_bytes: 600
function Main(input){
  input = input.split("\n");
  inputStr = input[0].split(" ");
  const N = Number.parseInt(inputStr[0]);
  inputStr = input[1].split(" ");
  const S = inputStr[0];
  //引数Sを重み付けして配列ANSに格納する
  var tmp = 1;
  for(var i=1 ; i<N ; i++){
    //console.log("loop内出力",S.substr(i,1));
    if( S.substr(i-1,1) !== S.substr(i,1) ){
      tmp++;
    }
  }
  //結果出力
  console.log(tmp);
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));


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

using namespace std;
using ll = long long;
// #define int ll
using PII = pair<ll, ll>;

#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()

template<typename T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template<typename T> T &chmax(T &a, const T &b) { return a = max(a, b); }
template<typename T> bool IN(T a, T b, T x) { return a<=x&&x<b; }
template<typename T> T ceil(T a, T b) { return a/b + !!(a%b); }

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

template<class S,class T>
ostream &operator <<(ostream& out,const pair<S,T>& a) {
    out<<'('<<a.first<<','<<a.second<<')'; return out;
}
template<class T>
ostream &operator <<(ostream& out,const vector<T>& a){
    out<<'[';
    for(const T &i: a) out<<i<<',';
    out<<']';
    return out;
}
template<class T>
ostream &operator <<(ostream& out, const set<T>& a) {
    out<<'{';
    for(const T &i: a) out<<i<<',';
    out<<'}';
    return out;
}
template<class T, class S>
ostream &operator <<(ostream& out, const map<T,S>& a) {
    out<<'{';
    for(auto &i: a) out<<i<<',';
    out<<'}';
    return out;
}

int dx[] = {0, 1, 0, -1}, dy[] = {1, 0, -1, 0}; // DRUL
const int INF = 1<<30;
const ll LLINF = 1LL<<60;
const ll MOD = 1000000007;

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

    ll n;
    cin >> n;
    vector<ll> a(n), b(n), c(n-1);
    REP(i, n) cin >> a[i];
    REP(i, n) cin >> b[i];
    REP(i, n-1) cin >> c[i];

    ll ret = 0;
    REP(i, n) {
        ret += b[a[i]-1];
        if(i>=1 && a[i-1]+1==a[i]) ret += c[a[i-1]-1];
    }
    cout << ret << endl;

    return 0;
}


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

char s[200005];
int main()
{
    scanf("%s",s);
    int len=strlen(s);
    int num=0;
    for(int i=0;i<len;i++)
    {
        num+=s[i]-'0';
    }
    if(num%9==0)
        puts("Yes");
    else
    {
        puts("No");
    }
    
    return 0;
}


Measured memory_bytes: 3860
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG //これつけるとA[N]でもいいらしい
//for文のマクロ
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define big 1000000007
#define all(a) sort((a).begin(),(a).end()) //ソートのマクロ
#define Re(a) reverse((a).begin(),(a).end())
#define YN(a) if(a){cout<<"Yes"<<endl;}else cout<<"No"<<endl;//条件によってYes、Noを出力する
const int MOD=1000000007;
const double pi = 3.141592653589793;
//エラトステネスの篩による素数列挙 O(NloglogN)
vector<int> prime;
void Eratosthenes(int N){
    vector<int> arr(N+1);
	for(int i = 0; i <= N; i++){
		arr[i] = 1;
	}
	for(int i = 2; i *i <=N; i++){
		if(arr[i]){
			for(int j = 0; i * (j + 2) <= N; j++){
				arr[i *(j + 2)] = 0;
			}
		}
	}
    for(int i=2;i<=N;i++){
        if(arr[i]){
            prime.push_back(i);
        }
    }

}
int main(){
    int n;
    cin>>n;
    set<int> s;
    vector<int> ans;
    Eratosthenes(55555);
    int sum=0;
    int k=0;
    //5で割って1余る素数だけ入れてけばどの5個選んでも5の倍数だね
    //天才すぎる　かっけえ・・・・・(思いつかなった)
    while(ans.size()!=n){
        if(prime[k]%5==1){
            ans.push_back(prime[k]);
        }
        k++;
    }
    rep(i,n){
        cout<<ans[i]<<" ";
    }
}

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

typedef long long ll;

int main() {
    ll N;
    cin >> N;
    vector<ll> v(N, 0), pos(N + 1, 0);
    for (ll i = 0; i < N; i++) {
        cin >> v[i];
        pos[v[i]] = i;
    }

    set<ll> s;
    ll ans = 0;
    for (ll i = N; i > 0; i--) {
        auto itr = s.upper_bound(pos[i]);
        auto itl = itr;

        ll r1 = itr == s.end() ? N : *(itr++);
        ll r2 = itr == s.end() ? N : *itr;
        ll l1 = itl == s.begin() ? -1 : *(--itl);
        ll l2 = itl == s.begin() ? -1 : *(--itl);

        ans += ((l1 - l2) * (r1 - pos[i]) + (r2 - r1) * (pos[i] - l1)) * i;
        s.insert(pos[i]);
    }

    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 6528
import java.util.Scanner;
import java.util.HashMap;
import java.util.Map;

public class Main
{
    Map<String, Integer> map = new HashMap<>();
    
    public static void main(String args[])
    {
	new Main().run();
    }
    
    void run()
    {
	in();
	
	out();
    }

    void in()
    {
	String str;
	Scanner sc = new Scanner(System.in);
	str = sc.next();
	
	for(String c : str.split("")) map.put(c, 1);
    }

    void out()
    {
	for(String c : "abcdefghijklmnopqrstuvwxyz".split("")) {
	    if(map.get(c) == null) {
		System.out.println(c);
		break;
	    }
	    if(c.equals("z")) System.out.println("None");
	}
    }
}


Measured memory_bytes: 31772