akhauriyash/Code-Regression huggingface dataset:
import java.io.PrintWriter
import java.util.*
import java.math.*
import java.lang.*

val pw = PrintWriter(System.out)
val MOD: Long = (1e+9 + 7).toLong()

fun main(args: Array<String>) {
    val n = readInt()
    val t = mutableListOf<Long>()
    for(i in 0 until n) {
        t.add(readLong())
    }
    val ans = t.fold(1L) { acc, x -> if(acc > x) lcm(acc, x) else lcm(x, acc) }
    println(ans)
    
    pw.flush()
}

/****** Decrared Functions and Data Structures ******/
// IO
fun read() = readLine()!!
fun readInt() = read().toInt()
fun readLong() = read().toLong()
fun readDouble() = read().toDouble()
fun readListOfString() = read().split(" ")
fun readListOfInt() = readListOfString().map { it.toInt() }
fun readListOfLong() = readListOfString().map { it.toLong() }
fun readListOfDouble() = readListOfString().map { it.toDouble() }

fun Double.format(digits: Int) = String.format("%.${digits}f", this)
fun Float.format(digits: Int) = String.format("%.${digits}f", this)

fun print(value: Any) { pw.print(value) }
fun println(value : Any) { pw.println(value) }

fun<T> permutations(src: List<T>): List<List<T>> {
    if(src.size == 1) return listOf(src)
    val perms = mutableListOf<List<T>>()
    val insertElement = src[0]
    permutations(src.drop(1)).forEach { perm ->
        for(i in 0..perm.size) {
            val newPerm = perm.toMutableList()
            newPerm.add(i, insertElement)
            perms.add(newPerm.toList())
    }
    }
    return perms
}

// return nCr, if you want nCr, please access v[n][r]
fun combinations(n: Long): List<List<Long>> {
    val v = (0..n).map { (0..n).map{0L}.toMutableList() }.toMutableList()
    for(i in 0 until v.size) {
        v[i][0] = 1L
        v[i][i] = 1L
    }
    for(i in 0 until v.size) {
        for(j in 1 until i) {
            v[i][j] = (v[i-1][j-1] + v[i-1][j] % MOD)
        }
    }
    return v.map { it.toList() }.toList()
}

// should be a >= b
fun gcd(a: Long, b: Long): Long = 
    if(b == 0L) a else gcd(b, a % b)

// shoud be a >= b
fun lcm(a: Long, b: Long): Long = 
    a / gcd(a, b) * b

fun sumDigits(num_: Long): Long {
    var num = num_
    var rtn: Long = 0
    while(num != 0.toLong()) {
        val tmp = num % 10
        rtn += tmp
        num /= 10
    }
    return rtn
}

fun isDecimal(v: Double): Boolean = ((v - Math.floor(v)) != 0.0)

// Data Structures
class Stack<T>(private var st: MutableList<T> = mutableListOf<T>()) {
    fun isEmpty() = st.isEmpty()
    fun top(): T = st.last()
    fun push(e: T) { st.add(e) }
    fun pop() { st = st.dropLast(1).toMutableList() }
}

class Queue<T>(private var que: MutableList<T> = mutableListOf<T>()) {
    fun isEmpty() = que.isEmpty()
    fun top(): T = que.first()
    fun push(e: T) { que.add(e) }
    fun pop() { que = que.drop(1).toMutableList() }
}


Measured memory_bytes: 33724
#include<bits/stdc++.h>
    using namespace std;
    #define ll long long int
    #define vv vector<ll>
    #define pp pair<ll,ll>
    #define ff first
    #define ss second
    #define vp vector<pp>
    #define ld long double
    #define pb push_back
    #define mp make_pair
    #define fast ios_base::sync_with_stdio(false);cin.tie(NULL);
    const ll mod=987654319;
    const ll N=200000;
    bool prime[N];
    const ll H=64;
    void isprime()
    {
        memset(prime,true,N);
        for(ll i=2;i*i<N;i++)
        {
            if(prime[i]==true)
            {
                for(ll j=i*i;j<N;j+=i)
                {
                    prime[j]=false;
                }
            }
        }
    }
    ll power(ll a,ll n)
    {
        ll ans=1;
        a=a%mod;
        while(n>0)
        {
            if(n&1)
            {
                ans=(ans*a)%mod;
            }
            n=n>>1;
            a=(a*a)%mod;
        }
        return ans;
    }
    ll gcd(ll a,ll b)
    {
        if(b==0)
        return a;
        
        return gcd(b,a%b);
    }
    int main()
    {
    	ll n,a,b,c,d;
    	cin>>n>>a>>b>>c>>d;
    	string s;
    	cin>>s;
		if(a<c && c<=b && b<d)
		{
			for(ll i=a-1;i<c-2;i++)
			{
				if(s[i+2]=='#' && s[i+1]=='#')
				{
					cout<<"No";
					return 0;
				}	
			}
			for(ll i=b-1;i<d-2;i++)
			{
				if(s[i+2]=='#' && s[i+1]=='#')
				{
					cout<<"No";
					return 0;
				}
			}
			cout<<"Yes";
		}
		else if(a<b && b<c && c<d)
		{
			for(ll i=b-1;i<d-2;i++)
			{
				if(s[i+2]=='#' && s[i+1]=='#')
				{
					cout<<"No";
					return 0;
				}
			}
			for(ll i=a-1;i<c-2;i++)
			{
				if(s[i+2]=='#' && s[i+1]=='#')
				{
					cout<<"No";
					return 0;
			    }	
			}
			cout<<"Yes";
		}
		else if(a<b && b<d && d<c)
		{
			ll j=0;
			for(ll i=b-1;i<d-2;i++)
			{
				if(s[i+2]=='#' && s[i+1]=='#')
				{
					cout<<"No";
					return 0;
				}
			}
			for(ll i=b-2;i<d-1;i++)
			{
				if(s[i]=='.' && s[i+2]=='.' && s[i+1]=='.')
				{
					j=1;
				}
			}
			//cout<<j<<endl;
			if(j==1)
			{
			for(ll i=a-1;i<c-2;i++)
			{
				if(s[i+2]=='#' && s[i+1]=='#')
				{
					cout<<"No";
					return 0;
				}	
			}
			cout<<"Yes";
		    }
		    else
		    {
		    	cout<<"No";
				return 0;
			}
		}
		return 0;
	}

Measured memory_bytes: 640
#include <iostream>
#include <set>
#include <vector>

int main()
{
    int n;
    std::cin >> n;

    std::vector<int> p(n);
    std::vector<int> idx(n);
    for (int i = 0; i < n; i++) {
        std::cin >> p[i];
        p[i]--;
        idx[p[i]] = i;
    }

    std::set<int> s;

    long long ans = 0;
    for (int i = n - 1; i >= 0; i--) {
        int id = idx[i];

        s.insert(id);

        std::vector<int> l(2, -1);
        std::vector<int> r(2, n);

        auto center = s.find(id);
        for (int j = 0; j < 2; j++) {
            if (center == s.begin()) {
                break;
            }
            center--;
            l[j] = *center;
        }

        center = s.find(id);
        for (int j = 0; j < 2; j++) {
            center++;
            if (center == s.end()) {
                break;
            }
            r[j] = *center;
        }

        std::vector<int> ls(2), rs(2);

        ls[0] = id - l[0];
        ls[1] = l[0] - l[1];
        rs[0] = r[0] - id;
        rs[1] = r[1] - r[0];

        long long c = (long long)ls[0] * rs[1] + (long long)ls[1] * rs[0];
        ans += c * (i + 1);
    }

    std::cout << ans << std::endl;
}


Measured memory_bytes: 5760
n = int(input())
a = [int(x) for x in input().split()]

I = a.count(3)
J = a.count(2)
K = a.count(1)

dp = [[[0 for _ in range(I+J+K+1)] for __ in range(I+J+1)]
      for ___ in range(I+1)]

for i in range(I+1):
    for j in range(I+J+1-i):
        for k in range(I+J+K+1-i-j):
            if i + j + k == 0:
                continue
            tmp = 0
            if k-1 > -1:
                tmp += (n/(i+j+k))*(k/n)*dp[i][j][k-1]
            if j-1 > -1:
                tmp += (n/(i+j+k))*(j/n)*dp[i][j-1][k+1]
            if i-1 > -1:
                tmp += (n/(i+j+k))*(i/n)*dp[i-1][j+1][k]
            dp[i][j][k] += n/(i+j+k) + tmp

print(dp[I][J][K])


Measured memory_bytes: 501640
# おっぱっぴー

A, B, C = map(int, input().split())

if A == B == C and A % 2 == B % 2 == C % 2 == 0:
    print(-1)
else:
    ans = 0
    while A % 2 == B % 2 == C % 2 == 0:
        A, B, C = B//2+C//2, A//2+C//2, A//2+B//2
        ans += 1

    print(ans)



Measured memory_bytes: 2940
#include <cmath>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <deque>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>

#define REP(i, n, N) for(ll i=(n);i<(N);i++)
#define RREP(i, n, N) for(ll i=(N-1);i>=(n);i--)
#define CK(n, a, b) ((a)<=(n)&&(n)<(b))
#define ALL(v) (v).begin(), (v).end()
#define MCP(a, b) memcpy(b,a,sizeof(b))
#define p(s) cout<<(s)<<endl
#define p2(a, b) cout<<(a)<<" "<<(b)<<endl
typedef long long ll;
using namespace std;
const ll mod = 1e9 + 7;
const ll inf = 1e18;

string S, T;

int main() {

    cin>>S>>T;

    REP(start ,0,S.size()){
        bool f = true;
        REP(i ,0,S.size()) {
            ll j = (start + i) % S.size();
            if (S[i] != T[j]){
                f = false;
                break;
            }
        }

        if (f) {
            cout<<"Yes"<<endl;
            return 0;
        }
    }

    cout<<"No"<<endl;

    return 0;
}


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

int main()
{
	int n;
	cin>>n;
	int64_t a[n]={};
	for(int i = 0 ; i < n ; i++)
		cin>>a[i];
	sort(a , a+n , greater<int64_t>());
	int64_t x = 0 , y = 0;
	for(int i = 1 ; i < n ; i++)
	{

		if(a[i] == a[i-1])
		{
			if( x == 0)
				x = a[i];
			else if ( y == 0)
				y = a[i];
			i+=1;
		}
		if( x && y)
			break;
	}
	cout<< x * y <<"\n";
	return 0;
}

Measured memory_bytes: 1024
// #pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
#define rep(i,n) for(int i=0;i<n;i++)
#define rep2(i,a,b) for(int i=(a);i<(b);++i)

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



int main() {
  ll N;
  cin >> N;
  ll ans=0;
  rep2(i,1,1+N){
    if (i%3!=0&&i%5!=0) ans+=i;
    }
  cout << ans << endl;
}

Measured memory_bytes: 3608
#include<iostream>
using namespace std;
#define maxn 100005
int A[maxn]={0};
int main()
{
	int n,num;
	cin>>n;
	for(int i=1;i<=n;++i)
	{
		cin>>num;
		A[num]=i;
	}
	for(int i=1;i<=n;++i)
	{
		cout<<A[i]<<' ';
	}	
	cout<<endl;
	return 0;
 } 

Measured memory_bytes: 1152
#include<iostream>
#include<algorithm>
#include<set>
#include<string>
#include<vector>
#include<queue>

using namespace std;


int N, M, K;
int belong[100000];
vector<int> friends[100000];
queue<int> que;

bool solve(int n) {
	for (int j = 0; j<friends[n].size(); j++) {
		int tmp = friends[n][j];
		if (belong[tmp] == belong[n]) {

		}
		else if (belong[tmp] == -1) {
			belong[tmp] = belong[n];
			que.push(tmp);
		}
		else {
			return false;
		}
	}
	return true;
}

bool cont = true;

int main() {
	cin >> N >> M >> K;

	for (int i = 0; i<N; i++) {
		belong[i] = -1;
	}

	for (int i = 0; i<K; i++) {
		int type;
		cin >> type;
		if (type == 1) {
			int a, b;
			cin >> a >> b;
			if (cont == false) continue;
			a--;
			b--;
			if (belong[a] != -1) {
				if (belong[b] == belong[a]) {

				}
				else if (belong[b] == -1) {
					belong[b] = belong[a];
					que.push(b);
				}
				else {
					cout << i + 1 << endl;
					cont = false;
					continue;
				}
			}
			if (belong[b] != -1) {
				if (belong[a] == belong[b]) {

				}
				else if (belong[a] == -1) {
					belong[a] = belong[b];
					que.push(a);
				}
				else {
					cout << i + 1 << endl;
					cont = false;
					continue;
				}
			}
			friends[a].push_back(b);
			friends[b].push_back(a);

			while (que.size() != 0) {
				bool tmp = solve(que.front());
				que.pop();
				if (tmp == false) {
					cout << i + 1 << endl;
					cont = false;
					continue;
				}
			}
		}
		if (type == 2) {
			int c, x;
			cin >> c >> x;
			if (cont == false) continue;
			c--;
			x--;

			if (belong[c] == x) {

			}
			else if (belong[c] == -1) {
				belong[c] = x;
				que.push(c);
			}
			else {
				cout << i + 1 << endl;
				cont = false;
				continue;
			}

			while (que.size() != 0) {
				bool tmp = solve(que.front());
				que.pop();
				if (tmp == false) {
					cout << i + 1 << endl;
					cont = false;
					continue;
				}
			}
		}
	}

	if (cont == true) cout << 0 << endl;
	return 0;
}




Measured memory_bytes: 8876
#include <bits/stdc++.h>
#define FOR(i, begin, end) for(int i=(begin);i<(end);i++)
#define REP(i, n) FOR(i,0,n)
#define IFOR(i, begin, end) for(int i=(end)-1;i>=(begin);i--)
#define IREP(i, n) IFOR(i,0,n)
#define SORT(a) sort(a.begin(), a.end())
#define REVERSE(a) reverse(a.begin(), a.end())
#define Lower_bound(v, x) distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x) distance(v.begin(), upper_bound(v.begin(), v.end(), x))
#define int long long
#define INF 1000000000000000000
using namespace std;

#define ANS(f) if(f) cout << "YES" << endl; else cout << "NO" << endl;

typedef vector<int> vec;
typedef vector<vec> mat;
typedef pair<int, int> Pii;

template<typename T>
void readv(vector<T> &a){ REP(i, a.size()) cin >> a[i]; }
void readi(vector<int> &a){ REP(i, a.size()){cin >> a[i]; a[i]--;} }
void debug(mat m){REP(i, m.size()){ REP(j, m[i].size()){ cout << m[i][j] << ","; } cout << endl; }}



signed main(){

    string S; cin >> S;
    int w; cin >> w;

    string ans = "";
    int i = 0;
    while(i < S.size()){
        ans += S[i];
        i += w;
    }
    cout << ans;
    
    return 0;
}

Measured memory_bytes: 256
n = int(input())
t,a = map(int,input().split())
l = list(map(int,input().split()))
#print(n,t,a,l)

x = []
for i in range(n):
    x.append( abs(a- (t - l[i] * 0.006)))
print(x.index(min(x))+1)


Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> Pii;
typedef pair<ll,ll> Pll;
#define rep(i,n) for (ll i=0;i<n;++i)
#define rep2(i,a,b) for (ll i=a;i<b;++i)
const ll MOD=1000000007;
string alp="abcdefghijklmnopqrstuvwxyz";

int main(){
    int N;
    cin >> N;
    int M=N/2;
    cout << N*(N-1)/2-M << endl;
    rep(i,N){
        rep2(j,i+1,N){
            if (i+j+2!=2*M+1){
                cout << i+1 << ' ' << j+1 << endl;
            }
        }
    }
}

Measured memory_bytes: 256
while(n=gets.to_i)>0
a=[0]*m=n+1
c="%5d"*m
n.times{i=-1;s=0;puts c%(gets.split.map{|j|a[i+=1]+=j=j.to_i;a[n]+=j;s+=j;j}<<s)}
puts c%a
end

Measured memory_bytes: 6124
#include <iostream>
#include <vector>
#define INF 1e09

using namespace std;

int graph[10][10];

void w_froid(){
	for(int k=0;k<10;++k){
		for(int i=0;i<10;++i){
			for(int j=0;j<10;++j){
				graph[i][j] = min(graph[i][j],graph[i][k]+graph[k][j]);
			}
		}
	}
}

int main(){
	int res = 0;
	int h,w;
	cin >> h >> w;
	for(int i=0;i<10;++i){
		for(int j=0;j<10;++j)cin >> graph[i][j];
	}
	w_froid();
	for(int i=0;i<h;++i){
		for(int j=0;j<w;++j){
			int a;
			cin >> a;
			if(a != -1)res += graph[a][1];
		}
	}
	cout << res << endl;
}

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

constexpr long long INF = 10000000007LL;
int N, W;
long long dp[100005];

int main() {
    cin >> N >> W;

    dp[0] = 0LL;
    for (int x = 1; x <= 100*1000; ++x)
        dp[x] = INF;

    int w, v;
    for (int i = 1; i <= N; ++i) {
        cin >> w >> v;
        for (int x = 100*1000; x >= 0; --x) {
            if (x - v >= 0)
                dp[x] = min(dp[x], dp[x - v] + w);
        }
    }

    long long ans = 0LL;
    for (int x = 100*1000; x >= 0; --x) {
        if (dp[x] <= W) {
            ans = x;
            break;
        }
    }
    cout << ans << endl;

}

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

int main(void) {
	vector<int> in;
	for(int i = 0; i < 10000; ++i) {
		int tmp;
		cin >> tmp;
		if (tmp == 0) break;
		in.push_back(tmp);
	}
	for (int i = 0; i < in.size(); ++i) {
		cout << "Case " << i + 1 << ": "<<  in[i] << endl;
	}

	return 0;
}


Measured memory_bytes: 3204
import java.util.Scanner;

class Main{

	static char[][] map;
	static int H;
	static int W;

	public static void main(String[] args) {



		Scanner sc = new Scanner(System.in);			//文字の入力
		//int N =sc.nextInt();
		int N =sc.nextInt();
		if(N%2 == 0){
			System.out.println(N);
			
			
		}else{
			System.out.println(N*2);

		}
		



	}
}




class Pair implements Comparable{
	String from;
	int end;
	@Override
	public int compareTo(Object other) {
		Pair otherpair = (Pair)other;

		return end - otherpair.end;
	}
}





Measured memory_bytes: 23124
#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define FOR(i,s,n) for(int i = s; i < (n); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(n) (n).begin(), (n).end()
#define RALL(n) (n).rbegin(), (n).rend()
#define ATYN(n) cout << ( (n) ? "Yes":"No") << endl;
#define CFYN(n) cout << ( (n) ? "YES":"NO") << endl;
using ll = long long;
using ull = unsigned long long;


int main(void)
{
    IOS
    int n; cin >> n;
    vector<string> v(n);
    map<string,ll> m;
    REP(i,n)  {
        cin >> v[i];
        sort(ALL(v[i]));
    }
    
    sort(ALL(v));
    
    ll ans = 0;

    REP(i,n) {
        try {
            m.at(v[i])++;
            ans += m.at(v[i]);
        } catch (out_of_range&) {
            m[v[i]] = 0;
        }

    }


    cout << ans << endl;


    return 0;
}

Measured memory_bytes: 13184
#include <stdio.h>
int main(void) {
	int hour, minute, second;
	hour = minute = 0;
	scanf("%d", &second);
	while(second >= 60) {
		second -= 60;
		minute += 1;
	}
	while(minute >= 60) {
		minute -= 60;
		hour += 1;
	}
	printf("%d:%d:%d\n", hour, minute, second);
	return 0;
}

Measured memory_bytes: 592
#include<stdio.h>
#include<utility>
#define rep(n) for(int i = 0;i < (n);i++)
struct Card{
    char ch;
    int val;
};

void Print(Card *a,int n){
    for(int i = 0;i < n;i++){
        if(i != n-1){
            printf("%c%d ",a[i].ch,a[i].val);
        } else {
            printf("%c%d\n",a[i].ch,a[i].val);
        }
    }
}
void BubbleSort(Card *a,int n){
    for(int i = 0;i < n ;i++){
        for(int j = n-1;j > i;j--){
            if(a[j].val < a[j-1].val) std::swap(a[j],a[j-1]);
        }
    }
    Print(a,n);
}

void SelectionSort(Card *a,int n){
    int min;
    for(int i = 0;i <= n-1;i++){
        min = i;
        for(int j = i;j <= n-1;j++) if(a[min].val > a[j].val) min = j;
        if(i != min) std::swap(a[i],a[min]);
    }
    Print(a,n);
}

bool isStable(Card *in,Card *out,int n){
    for(int i = 0;i < n;i++){
        for(int j = i+1;j < n;j++){
            for(int a = 0;a < n;a++){
                for(int b = a+1;b < n;b++){
                    if(in[i].val == in[j].val && in[i].ch == out[b].ch && in[j].ch == out[a].ch && in[i].val == out[b].val && in[j].val == out[a].val ) return false;
                }
            }
        }
    }
    return true;
}

void ValidStable(Card *in,Card *out,int n){
    if(isStable(in,out,n)){
        printf("Stable\n");
    } else {
        printf("Not stable\n");
    }
}


int main(){
    int n;char tmp;
    scanf("%d",&n);
    Card c[n],cB[n],cS[n];
    for(int i = 0;i < n;i++){
        scanf("%c",&tmp);
        scanf("%c%d",&c[i].ch,&c[i].val);
        cB[i] = c[i];
        cS[i] = c[i];
    }
    BubbleSort(cB,n);
    ValidStable(c,cB,n);
    SelectionSort(cS,n);
    ValidStable(c,cS,n);
}






Measured memory_bytes: 2760
'''input
010
'''

def list_input():
    return list(map(int,input().split()))
def map_input():
    return map(int,input().split())
def map_string():
    return input().split()
    
s = input()
n = len(s)
l = (n-1)//2
r = n//2
ans = n//2
cur = s[l]
while l >= 0:
	if s[l] == s[r] and s[l] == cur:
		ans += 1
		l -= 1
		r += 1
	else: break
print(ans)		    

Measured memory_bytes: 3188
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<set>
#include<map>
#include<queue>
#include<cmath>
#define REP(i,a) for (int i = 0;i < (a);++i)
#define FOR(i,a,b) for (int i = (a);i < (b); ++i)
#define FORR(i,a,b) for (int i = (a);i >= (b); --i)
#define ALL(obj) (obj).begin(),(obj).end()
#define SORT(list) sort(ALL((list)));
#define MOD 1000000007
using namespace std;
using ll = long long;
int main(){
    ll n;
    cin >> n;
    vector<ll>a(n);
    vector<int>count(n,0);
    int zerocount;
    REP(i,n){
        cin >> a[i];
    }
    if(a[0]!=0){
        cout << 0 << endl;
        return 0;
    }

    ll answer=1;
    REP(i,n){
        if(a[i]==0){
            answer = (answer*(3-count[0]))%MOD;
        }
        else{
            if(count[a[i]]>=count[a[i]-1]){
                cout << 0 << endl;
                return 0;
            }
            answer = (answer*(count[a[i]-1]-count[a[i]]))%MOD;
        }
        count[a[i]]++;
        if(count[a[i]]>3){
            cout << 0 << endl;
            return 0;
        }
    }
    cout << answer << endl;
    return 0;
}

Measured memory_bytes: 4548
[N,M]=list(map(int, input().split()))
ac=[0 for i in range(N)]
wa=[0 for i in range(N)]
p=[]
S=[]
WA=0

for i in range (0,M):
    [a,b]=input().split()
    p.append(int(a))
    S.append(b)

for i in range (0,M):
    if S[i]=="WA":
        if ac[p[i]-1]==0:
            wa[p[i]-1]=wa[p[i]-1]+1
    else:
        if ac[p[i]-1]==0:
            ac[p[i]-1]=1

for i in range (0,N):
    if ac[i]==1:
        WA=WA+wa[i]

AC=ac.count(1)
print(str(AC)+" "+str(WA))

Measured memory_bytes: 61232
using System;
using System.Collections.Generic;
using System.Linq;

namespace ABC177
{
    public class Program
    {
        public static void Main()
        {
            int N = int.Parse(Console.ReadLine());
            string[] input = Console.ReadLine().Split(" ");
            long[] A = new long[N];
            for(var i = 0; i < N; i++)
            {
                A[i] = long.Parse(input[i]);
            }

            long sum = A.Sum();
            long result = 0;

            for(var i = 0; i < N - 1; i++)
            {
                sum -= A[i];
                long value = (A[i] % 1000000007) * (sum % 1000000007);
                result += value % 1000000007;  
            }
            Console.WriteLine(result % 1000000007);
        }
    }
}



Measured memory_bytes: 47144
#include <bits/stdc++.h>
 
using namespace std;
 
const int N = 50;
 
int main() {
  int n;
  long long int a[N + 1];
  scanf("%d", &n);
  for (int i = 1; i <= n; ++i) {
    scanf("%lld", &a[i]);
  }
  long long res= 0;
  bool find = true;
  while (find) {
    find = false;
    for (int i = 1; i <= n; ++i) {
      if (a[i] >= n) {
        find = true;
        long long g = a[i] / n;
        res += g;
        a[i] %= n;
        for (int j = 1; j <= n; ++j) {
          if (j != i) {
            a[j] += g;
          }
        }
      }
    }
  }
  printf ("%lld\n", res);
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <string>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <cassert>

using namespace std;

#define FOR(i,k,n) for(int i=(k); i<(int)(n); ++i)
#define REP(i,n) FOR(i,0,n)
#define FORIT(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)

template<class T> void debug(T begin, T end){ for(T i = begin; i != end; ++i) cerr<<*i<<" "; cerr<<endl; }
inline bool valid(int x, int y, int W, int H){ return (x >= 0 && y >= 0 && x < W && y < H); }

typedef long long ll;
const int INF = 100000000;
const double EPS = 1e-8;
const int MOD = 1000000007;
int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
bool solve(vector<int>& a, vector<int>& b){
  int N = a.size();
  sort(a.begin(), a.end(), greater<int>());
  sort(b.begin(), b.end(), greater<int>());
  for(int i = 0; i < N; i++){
    int x = a[i];
    if(x == 0) break;
    if(x > N) return false;
    if(b[x - 1] <= 0) return false;
    if(x != N && b[x] == b[x - 1]) return false;
    for(int j = 0; j < x; j++){ b[j] --; }
  }
  for(int i = 0; i < N; i++) if(b[i] != 0) return false;
  return true;
}

int main(){
  int N;
  while(cin>>N && N){
    vector<int> a(N), b(N);
    REP(i, N) cin>>a[i];
    REP(i, N) cin>>b[i];
    if(solve(a, b)) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
  }
  return 0;
}

Measured memory_bytes: 1284
#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 int long long
#define endl '\n'
#define pb push_back
#define fi first
#define se second
#define all(c) (c).begin(),(c).end()
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef vector<int> vi;

template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

#define TRACE
#ifndef ONLINE_JUDGE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
	cerr << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
	const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...)
#endif

const ll inf = 2e18;
const int mod = 1e9 + 7;
const int N = 2e5 + 10;

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

	int n;
	cin >> n;
	string s;
	cin >> s;
	int l = 0, r = n - 1;
	while(l < n && s[l] == 'R') {
		l++;
	}
	while(r >= 0 && s[r] == 'W') {
		r--;
	}
	int ans = 0;
	while(l < r) {
		ans++;
		swap(s[l], s[r]);
		while(l < n && s[l] == 'R') {
			l++;
		}
		while(r >= 0 && s[r] == 'W') {
			r--;
		}
	}
	cout << ans;

	return 0;
}

Measured memory_bytes: 3740
import java.util.Scanner;

public class Main{

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		
		int N = sc.nextInt();
		int[] nums = new int[N];
		
		for(int i = 0; i < N; i++) {
			nums [i] = sc.nextInt();
		}
		
		int[] L = new int[N+1];
		int[] R = new int[N+1];
		
		L[0] = 0;
		R[N] = 0;
		
		for(int i = 0; i < N; i++) {
			L[i+1] = gcd(nums[i], L[i]);
		}
		
		for(int j = N-1; 0 < j; j--) {
			R[j] = gcd(nums[j], R[j+1]);
		}
		
		int answer = 1;
		int gcd = 1;
		
		for(int i = 0; i < N; i++) {
			gcd = gcd(L[i], R[i+1]);
			if(gcd > answer) {
				answer = gcd;
			}
		}
		
		System.out.println(answer);
	}

	public static int gcd(int num1, int num2){
		//ユークリッドの互除法により２数の最大公約数を求めるメソッド
		int num3 =1;

		if(num2 > num1) {
			//num1 >= num2 となるように並べ替え
			num3 = num2;
			num2 = num1;
			num1 = num3;
		}
		
		if(num2 <= 0) {
			return num1;
		}

		num3 = num1 % num2;

		while(num3 != 0){
			num1 = num2;
			num2 = num3;
			num3 = num1 % num2;
		}
		//割り切れた時の小さいほうの数がgcd
		return num2;
	}
}

Measured memory_bytes: 50928
/* https://codeforces.com/contest/1360/problem/H */
#include<bits/stdc++.h>

using namespace std;
using ll = long long;
using vs = vector<string>;
using vi = vector<int>;
using vl = vector<ll>;
using vb = vector<bool>;
using pi = pair<int, int>;
using pl = pair<ll, ll>;
using vpi = vector<pair<int, int>>;
using vpl = vector<pair<ll, ll>>;
using ld = double;

#define f first
#define s second 
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
#define for1(i, n) for (int i = 1; i <= (int)(n); ++i)
#define ford(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define fore(i, a, b) for (int i = (int)(a); i <= (int)(b); ++i)
#define pb push_back
#define	lb lower_bound
#define	ub upper_bound
#define	sz(x) (int)(x).size()
#define all(x) x.begin(), x.end()
#define ins insert

const int MAX = INT_MAX;

int main() {
	
	int N;
	cin>>N;
	int x = ceil((double)N/(double)1000);
	cout<<x*1000-N<<endl;
	return 0;
}


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

int main(){
  int a, b;
  cin >> a >> b;
  if(a<b) cout << "a < b" << endl;
  if(a>b) cout << "a > b" << endl;
  if(a==b) cout << "a == b" << endl;
  return 0;
}

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

int main(){
  int N;
  cin>>N;
  vector<pair<int,int>> a(N);
  int m=0;
  for(int i=0;i<N;i++){
    cin>>m;
    a[i]=make_pair(m,i);
  }
  sort(a.begin(),a.end());
  if(a[N-1].first==a[N-2].first){
    for(int i=0;i<N;i++){
      cout<<a[N-1].first<<endl;
    } 
  } else {
    for(int i=0;i<N;i++){
      if(i==a[N-1].second){
        cout<<a[N-2].first<<endl;
      } else {
        cout<<a[N-1].first<<endl;
      }
    }
  }
}

Measured memory_bytes: 3200
#include <regex>
#include "bits/stdc++.h"
#define FOR(i, s, e) for (int i = int(s); i < int(e); ++i)
#define REP(i, e) FOR(i, 0, e)
#define INF (INT_MAX / 2)
#define LINF (LLONG_MAX / 2)
#define EPS (1.0e-8)
const int MGN = 10;
const int ARY_SZ_MAX = (int)1e7;
using namespace std;
using ll = long long; using ull = unsigned long long;
using vi = vector<int>; using vvi = vector<vi>;
using vc = vector<char>; using vvc = vector<vc>;
using vb = vector<bool>; using vvb = vector<vb>;
using vl = vector<ll>; using vvl = vector<vl>;
using vd = vector<double>; using vs = vector<string>;
using pii = pair<int, int>; using pll = pair<ll, ll>; using psl = pair<string, ll>;

int bs_cnt_less(vl& A, const ll X, bool equal) {
    if (equal) return upper_bound(A.begin(), A.end(), X) - A.begin();
    else return lower_bound(A.begin(), A.end(), X) - A.begin();
}

int bs_cnt_greater(vl& A, const ll X, bool equal) {
    if (equal) return A.end() - lower_bound(A.begin(), A.end(), X);
    else return A.end() - upper_bound(A.begin(), A.end(), X);    
}

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


  ll N,M; cin>>N>>M;
  vl A(N); REP(i,N) cin>>A[i];

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

  ll l = 2, r = 1e5*2+1;

  while(l < r-1) { // [l,r)
    ll m = (l+r)/2;
    
    ll num = 0;
    REP(i,N) {
      num += bs_cnt_greater(A, m-A[i], true);
    }

    if (num>=M) {
      l = m;
    } else {
      r = m;
    }
  }

  vl sum(N+1,0);
  REP(i,N) sum[i+1] = sum[i] + A[i];

  ll ans = 0, num = 0;
  REP(i,N) {
    int rlt = bs_cnt_less(A, r-A[i], false);
    //int rge = bs_cnt_greater(A, r-A[i], true);

    assert(l+1 == r);
    //assert(rlt + rge == N);

    num += N-rlt;
    ans += A[i]*(N-rlt) + (sum[N] - sum[rlt]);
  }
  ans += l*(M-num);
 
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
#define  rep(i, n) for(int i = 0; i < n; i++) 
#define  all(x) (x).begin(),(x).end()     // 昇順ソート
#define  rall(v) (v).rbegin(), (v).rend() // 降順ソート
#define  INF 1LL << 60
typedef long long int LL;
typedef long long int ll;
#define pll pair<ll, ll>
#define F first
#define S second
const int MOD = 1000000007;
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 (a>b) { a=b; return true; } return false; }
//sort(all(x))とするとソートできるよ
// 10^x は pow(10,(x)) 
// 任意のlogは　対数の底の変換を使う    log(N) / log(任意の底)

int main(){
    string S;cin >> S;
    int Sn = S.size();
    string t = "";
    rep(i,Sn)t.push_back('x');
    cout << t << endl;
}


Measured memory_bytes: 256
N,K = list(map(int,input().split()))
d = []
A = []
for i in range(K):
    d.append(int(input()))
    A.extend(list(map(int,input().split())))

A.sort()
A = set(A)
count = 0
for i in range(1,N+1):
    if i in A:
        pass
    else:
        count += 1
print(count)

Measured memory_bytes: 67644
import java.io.IOException;

import java.io.BufferedReader;
import java.io.InputStreamReader;

import java.io.PrintWriter;

@SuppressWarnings("unchecked")
public class Main {
    public static void main(String[] args) throws IOException {
        final String S;

        try (
            BufferedReader reader = new BufferedReader(
                new InputStreamReader(System.in))) {
            S = reader.readLine();
        }

        PrintWriter out = new PrintWriter(System.out);

        int len = S.length();

        int ans = Integer.MAX_VALUE;

        for (int i = 3; i <= len; i++) {
            String s = S.substring(i - 3, i);
            int num = Integer.parseInt(s);

            ans = Math.min(ans, Math.abs(num - 753));
        }

        out.println(ans);

        out.flush();
    }
}


Measured memory_bytes: 20948
import std.stdio, std.conv, std.functional, std.string;
import std.algorithm, std.array, std.container, std.range, std.typecons;
import std.numeric, std.math, std.random;
import core.bitop;

string FMT_F = "%.10f";

static File _f;
void file_io(string fn) { _f = File(fn, "r"); }
static string[] s_rd;
T _RD(T = long)() { while(!s_rd.length) s_rd = readln.chomp.split; string res = s_rd[0]; s_rd.popFront; return res.to!T; }
T _RD(T = long)(File f) { while(!s_rd.length) s_rd = f.readln.chomp.split; string res = s_rd[0]; s_rd.popFront; return res.to!T; }
T[] _RDA(T = long)(T fix = 0) { auto r = readln.chomp.split.to!(T[]); r[] += fix; return r; }
T[] _RDA(T = long)(File f, T fix = 0) { auto r = f.readln.chomp.split.to!(T[]); r[] += fix; return r; }
T RD(T = long)() { if (_f.isOpen) return _RD!T(_f); else return _RD!T; }
T[] RDA(T = long)(T fix = 0) { if (_f.isOpen)  return _RDA!T(_f, fix); else return _RDA!T(fix); }

size_t[] MAKE_IDX(alias less = "a < b", Range)(Range range) { auto idx = new size_t[](range.length); makeIndex!(less)(range, idx); return idx;}
size_t MIN_POS(alias less = "a < b", Range)(Range range) { auto r = minPos!(less)(range); return range.length - r.length; }

bool inside(T)(T x, T b, T e) { return x >= b && x < e; }
long lcm(long x, long y) { return x * (y / gcd(x, y)); }

//long mod = 10^^9 + 7;
long mod = 998244353;
//long mod = 1_000_003;
void moda(ref long x, long y) { x = (x + y) % mod; }
void mods(ref long x, long y) { x = ((x + mod) - (y % mod)) % mod; }
void modm(ref long x, long y) { x = (x * y) % mod; }

void main()
{
	auto N = RD;
	auto S = RD!string;
	if (N % 2 == 1)
		writeln("No");
	else
	{
		bool ans = true;
		foreach (i; 0..N/2)
		{
			if (S[i] != S[N/2+i])
				ans = false;
		}
		writeln(ans ? "Yes" : "No");
	}

	stdout.flush();
	debug readln();
}

Measured memory_bytes: 256
W, H, N = map(int, input().split())
xya = [tuple(map(int, input().split())) for _ in range(N)]

l = 0
b = 0
r = W
t = H
for x,y,a in xya:
    if a == 1: l = max(l, x)
    elif a == 2: r = min(r, x)
    elif a == 3: b = max(b, y)
    elif a == 4: t = min(t, y)
print(max(0, r-l) * max(0, t-b))

Measured memory_bytes: 38256
#include <cstdio>
#include <algorithm>

typedef long long i64;

const int N = 1000 + 10;

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

int main() {
  int n;
  i64 a, b;
  scanf("%d%lld%lld", &n, &a, &b);
  for (int i = n - 1; i--;) {
    int x, y;
    scanf("%d%d", &x, &y);
    //k * x >= a
    i64 k = std::max((a + x - 1) / x, (b + y - 1) / y);
    a = k * x, b = k * y;
  }
  printf("%lld\n", a + b);
  return 0;
}


Measured memory_bytes: 128
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<cstdlib>
using namespace std;
int s[100010],fa[100010];
char ss[100010];
int main()
{
	scanf("%s",ss+1);
	int len=strlen(ss+1);
	for(int i=1;i<=len;i++)s[i]=ss[i]-'0';
	bool bk=true;
	if(s[1]==0 || s[len]==1)bk=false;
	for(int i=1;i<=len;i++)if(s[i]^s[len-i]){bk=false;break;}
	if(bk==false)printf("-1\n");
	else
	{
		int root=1,ul=len-1,id=1;
		for(int i=len/2;i>=1;i--)
		{
			if(s[i]==1)
			{
				for(int j=1;j<=ul-i+1;j++)printf("%d %d\n",root,++id);
				root=id;ul=i-1;
			}
		}
	}
	return 0;
}

Measured memory_bytes: 1664
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
#define FOR(i,a,n) for(int i=(a); i<(n); i++)
#define all(v) v.begin(), v.end()
#define fi first
#define se second
using namespace std;
using ll = long long;
using P = pair<int ,int>;
const int INF = 1e9;
const int MOD = 1e9+7;

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

    int n; cin >> n;
    vector<int> a(n), b(n), c(n);
    rep(i, n) cin >> a[i];
    rep(i, n) cin >> b[i];
    rep(i, n) cin >> c[i];
    sort(all(a)); sort(all(b)); sort(all(c));

    ll ans = 0;
    for (const auto & mid: b) {
        auto it1 = upper_bound(all(c), mid);
        if (it1 == c.end()) continue;
        auto it2 = lower_bound(all(a), mid);
        // if (it2 == a.end()) continue;
        ans += (c.end()-it1) * (it2-a.begin());
    }

    cout << ans << endl;
}

Measured memory_bytes: 1536
#include <bits/stdc++.h> 
using namespace std;  
#define ll   long long int
int main()
{
	string s;
	cin>>s;
	string s1;
	cin>>s1;
	ll count = 0;
	for(ll i = 0;i<s.length();i++)
	{
		if(s[i]!=s1[i])count++;
	}
	cout<<count<<endl;
} 


Measured memory_bytes: 3856
#include<stdio.h>
int rec(int,int);
int a[101][101];
int p[101];

int main(){
    int n,i,b,j;
    scanf("%d",&n);
    for(i=1;i<=n;i++)a[i][i]=0;
    scanf("%d%d",&p[0],&p[1]);
    for(i=2;i<=n;i++)scanf("%d%d",&b,&p[i]);
    for(i=1;i<n;i++)a[i][i+1]=p[i-1]*p[i]*p[i+1];
    for(j=0;j<=n-3;j++){
        for(i=3+j;i<=n;i++){
            a[i-2-j][i]=rec(i-2-j,i);
        }
    }

    printf("%d\n",a[1][n]);
    return 0;
}

int rec(int x,int y){
    int b,i;
    int m=1000000000;
    b=y-x;
    for(i=0;i<b;i++){
        if(m>(a[x][x+i]+a[x+i+1][y]+p[x-1]*p[x+i]*p[y]))
        m=a[x][x+i]+a[x+i+1][y]+p[x-1]*p[x+i]*p[y];
    }
    return m;
}


Measured memory_bytes: 2112
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <climits>

#define rep(i, m, n) for(int i=int(m);i<int(n);i++)
#define EACH(i, c) for (auto &(i): c)
#define all(c) begin(c),end(c)
#define EXIST(s, e) ((s).find(e)!=(s).end())
#define SORT(c) sort(begin(c),end(c))
#define pb emplace_back
#define MP make_pair
#define SZ(a) int((a).size())

//#define LOCAL 0
//#ifdef LOCAL
//#define DEBUG(s) cout << (s) << endl
//#define dump(x)  cerr << #x << " = " << (x) << endl
//#define BR cout << endl;
//#else
//#define DEBUG(s) do{}while(0)
//#define dump(x) do{}while(0)
//#define BR
//#endif


//改造
typedef long long int ll;
using namespace std;
#define INF (1 << 20)
#define INFl (ll)5e15
#define DEBUG 0 //デバッグする時1にしてね
#define dump(x)  cerr << #x << " = " << (x) << endl

//ここから編集する
int ceili(int a,int b){
    if(a % b == 0){
        return a / b;
    } else{
        return a / b + 1;
    }
}

int main() {
    string s;
    cin >> s;
    int num[3] = {};
    rep(i,0,s.size()){
        num[s[i]-'a']++;
    }

    rep(i,0,3){
        if(num[i] > ceili(s.size(),3)){
            cout << "NO" << endl;
            return 0;
        }
    }
    cout << "YES" << endl;
    return 0;
}


Measured memory_bytes: 512
import java.util.*;

public class Main {
	public static void main (String[] args) {
		Scanner sc = new Scanner(System.in);
		String x = sc.next();
		int ss = 0;
		int ts = 0;
		for (int i = 0; i < x.length(); i++) {
			if (x.charAt(i) == 'S') {
				ss++;
			} else {
				if (ss == 0) {
					ts++;
				} else {
					ss--;
				}
			}
		}
		System.out.println(ss + ts);
	}
}


Measured memory_bytes: 26564
#include <stdio.h>
int main (void){
    int loop1;
    int data[3];
    scanf("%d %d %d",&data[0],&data[1],&data[2]);
    int how_7=0;
    int how_5=0;
    for(loop1=0;loop1<3;loop1++){
        if(data[loop1]==5){
            how_5++;
        }
        if(data[loop1]==7){
            how_7++;
        }
    }
    if(how_5==2 && how_7==1){
        printf("YES\n");
    }else{
        printf("NO\n");
    }
    return 0;
}

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

static const int MOD=1e9+7;

int main(){
    int H,W; cin >> H >> W;
    char a[H][W];
    for(int i=0;i<H;i++){
        for(int j=0;j<W;j++){
            cin >> a[i][j];
        }
    }
    int dp[H][W]={};
    dp[0][0]=1;
    int dx[4]={-1,1,0,0};
    int dy[4]={0,0,-1,1};
    for(int i=0;i<H;i++){
        for(int j=0;j<W;j++){
            for(int k=0;k<4;k++){
                if(i+dx[k]>=0&&j+dy[k]>=0&&i+dx[k]<H&&j+dy[k]<W){
                    if(a[i+dx[k]][j+dy[k]]=='#') continue;
                    dp[i+dx[k]][j+dy[k]]+=dp[i][j];
                    dp[i+dx[k]][j+dy[k]]%=MOD;
                }
            }
        }
    }
    cout << dp[H-1][W-1] << endl;
}

Measured memory_bytes: 5120
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mod 1000000007
typedef long long ll;

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

    int n,t;
    cin >> n >> t;
    vector<pair<int,int> > a;
    for(int i=0;i<n;i++){
        int c,time;
        cin >> c >> time;
        a.pb({c,time});
    }
    sort(a.begin(),a.end());
    for(int i=0;i<n;i++){
        if(a[i].second<=t){
            cout << a[i].first;
            return 0;
        }
    }
    cout << "TLE";
}

Measured memory_bytes: 256
object Main extends App {
  val param = scala.io.StdIn.readLine.split(' ')
  val D = param(0).toInt
  val T = param(1).toInt
  val S = param(2).toInt
 
  val t = Math.ceil(D.toDouble / S)
 
  if (t > T) {
    println("No")
  } else {
    println("Yes")
  }
}
 


Measured memory_bytes: 54712
#include<iostream>
#include<vector>
#include<climits>
#include<algorithm>
#include<queue>
#include<stack>
#include<string>

using namespace std;

#define MOD ((long long)1e9 + 7)

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

	int N;
	string S;

	cin >> N >> S;

	int alpha[200];

	for (int i = 0; i < 200; i++)
		alpha[i] = 0;

	for (auto s : S)
		alpha[s]++;

	long long result = 1;

	for (int i = 'a'; i <= 'z'; i++)
		result = (result * (alpha[i] + 1)) % MOD;

	if (result == 0)
		result = MOD;

	result--;

	cout << result;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
#ifdef BUG
    #include "debug.hpp"
#else
    #define DEBUG(var)
#endif

using namespace std;
template< class T1, class T2 > inline istream &
operator>>( istream & fin, pair< T1, T2 > & pr )
{ fin >> pr.first >> pr.second; return fin; }
template< class T0, class T1, class T2 > inline istream &
operator>>( istream & fin, tuple< T0, T1, T2 > & t )
{ fin >> get<0>(t) >> get<1>(t) >> get<2>(t); return fin; }
template< class T > inline istream &
operator>>( istream & fin, vector< T > & a ) {
for(auto & u: a) fin >> u; return fin; }
template<class T, size_t n> inline istream &
operator>>( istream & fin, array<T, n> & a ) {
for(auto & u: a) fin >> u; return fin; }
template<class FwdIter> inline auto
dump(FwdIter first, FwdIter last, const char * dlm = " ") -> void {
typedef typename iterator_traits<FwdIter>::value_type value_type;
copy(first, last, ostream_iterator<value_type>(cout, dlm)); }
template<typename T> vector<T> & operator--(vector<T> & a)
{ for(auto & i: a) --i; return a; }
/* @@@ ----------------------------------- */

void agc012b()
{
  size_t n, m;
  cin >> n >> m;

  vector<vector<size_t>> adj(n);
  for(size_t i = 0, u, v; i < m; ++ i)
  {
    cin >> u >> v;
    -- u; -- v;
    adj[u].push_back(v);
    adj[v].push_back(u);
  }

  typedef struct {
    size_t idx;
    size_t col;
  } value_t;

  vector<vector<value_t>> a(n, vector<value_t>(11, value_t({0, 0})));
  vector<value_t> out(n, {0, 0});

  size_t q;
  cin >> q;
  for(size_t i = 0, v, d, c; i < q; ++i)
  {
    cin >> v >> d >> c;
    --v;
    a[v][d].idx = i;
    a[v][d].col = c;
  }

  for(size_t j = 10; j < 11; --j)
    for(size_t i = 0; i < n; ++ i)
      if(a[i][j].col)
      {
        if(!out[i].col || out[i].idx < a[i][j].idx)
          out[i] = a[i][j];

        if(j != 0)
          for(const auto v: adj[i])
            if(!a[v][j - 1].col || a[v][j - 1].idx < a[i][j].idx)
              a[v][j - 1] = a[i][j];
      }

  for(const auto & r:out)
    cout << r.col << '\n';
}

int main(const int argc, char * argv [])
{
  ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
  agc012b();

  return EXIT_SUCCESS;
}



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

int main () {
  string s;
  cin >> s;
  
  bool C = false, F = false;
  for (int i = 0; i < s.size(); i++) {
    if (s.at(i) == 'C') {
      C = true;
      for (int j = i + 1; j < s.size(); j++) {
        if (s.at(j) == 'F') {
          F = true;
        }
      }
    }
  }
  if (C && F) {
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }
}

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

using namespace std;

int main() {
#ifdef LOCAL
  freopen("input.txt", "r", stdin);
#endif
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  long long A, B, N;
  cin >> A >> B >> N;
  if (A >= B) {
    int mn = min(N, B - 1);
    long long ans = A * mn / B - A * (mn / B);
    cout << ans << "\n";
  }
  else {
    long long ans = A * min(N, B - 1) / B - A * (min(N, B - 1) / B);
    cout << ans << "\n";
  }
  return 0;
}

Measured memory_bytes: 3648
import sys
import math
input = sys.stdin.readline


def comb(n):
    dp = [[0] * (n + 1) for i in range(n + 1)]
    for i in range(n + 1):
        dp[i][0] = 1
        dp[i][i] = 1
    for i in range(2, n + 1):
        for j in range(1, i):
            dp[i][j] = dp[i-1][j-1] + dp[i-1][j]
    return dp


n, a, b = map(int, input().split())
v = list(map(int, input().split()))

v.sort(reverse=True)
comb_list = comb(n)

ans = 0.0
for i in range(a):
    ans += v[i]
ans /= a

x, y = 0, 0
for i in range(n):
    if v[i] == v[a-1]:
        x += 1
        if i < a:
            y += 1

cnt = 0
if y == a:
    for i in range(a, b+1):
        cnt += comb_list[x][i]
else:
    cnt += comb_list[x][y]

print(ans)
print(cnt)



Measured memory_bytes: 3064
#include <iostream>
#include <stdio.h>
#include <vector>
#include <string>
#include <set>
#include <queue>
#include <cmath>
#include <map>
#include <algorithm>
#include <stack>
#include <cstring>

#define ll long long
#define MP make_pair
#define PB push_back
#define P push
#define f first
#define se second
#define S size()
#define B begin()
#define E end()
#define PI acos(-1)
#define fscan1(n)  scanf("%d",&(n));
#define fscan2(n,m)  scanf("%d %d",&(n),&(m));
#define fscan3(n,m,k)  scanf("%d %d %d",&(n),&(m),&(k));

const int N = 1e5 + 100;
const int M = 2e5 + 100;
const ll oo = 1e18;

int n, m, k, t, q, h, a, b, c, x, y, z;
using namespace std;

int ar[N][3];
int dp[N][3];


int rec(int ind, int act){
	if(ind == n)return 0;

	int &ret = dp[ind][act];

	if(ret != -1)return ret;

	return ret = max(rec(ind + 1, (act + 1) % 3),rec(ind + 1, (act + 2) % 3)) + ar[ind][act];
}


int main(){
	
	cin >> n;
	memset(dp, -1, sizeof dp);
	for(int i = 0; i < n; i++){
		cin >> ar[i][0] >> ar[i][1] >> ar[i][2];
	}
	int ans = max(rec(0,0), max(rec(0, 1), rec(0, 2)));

	cout << ans << endl;
	

	return 0;
 }




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

int main() {
  int a;
  int b;
  int x;
  int y;
  
  cin >> a >> b;
  
  x = (a + b) / 2;
  y = (a + b) % 2;
  
  cout << x + y << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <iostream>
#include <vector>
#include <string>
#include <numeric>
#include <iostream>
#include <cmath>
#include <algorithm>
#include <iomanip>
#include <queue>
#include <tuple>

#define rep(i,n) for(ll i=0;i<n;i++)
#define dup(x,y) (((x)+(y)-1)/(y)) // dup * y >= x なる最小のdup.
using namespace std;
typedef long long ll;
using Graph = vector<vector<ll>>;
//	std::cout<<std::fixed<<std::setprecision(10);

int main() {
	ll T1, T2, A1, A2, B1, B2;
	cin >> T1 >> T2 >> A1 >> A2 >> B1 >> B2;
	string inf = "infinity";

	ll dist[2] = {T1*(A1-B1), T2*(A2-B2)};
	if(dist[0]>0) {
		dist[0] *= -1;
		dist[1] *= -1;
	}
	//cout << dist[0] << ' ' << dist[1] << endl;

	if(dist[0]+dist[1]==0) {
		cout << inf << endl;
	} else if(dist[0]+dist[1]<0) {
		cout << 0 << endl;
	}else {
		ll ans = 2*((-dist[0])/(dist[0]+dist[1]))+1;
		if((-dist[0])%(dist[0]+dist[1])==0) ans--;
		cout << ans << endl;
	}

	return 0;
}

Measured memory_bytes: 256