akhauriyash/Code-Regression huggingface dataset:
import java.util.Arrays;
import java.util.Scanner;

class Main {
    public static void main(final String[] args) {
        Scanner scan = new Scanner(System.in);
        int p = scan.nextInt();
        int q = scan.nextInt();
        int r = scan.nextInt();
        int[] temp = {p,q,r};
        Arrays.sort(temp);
        System.out.println(temp[0] + temp[1]);
    }

}


Measured memory_bytes: 21972
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
 
namespace AtCoder
{
    class Program
    {
 
        static void Main()
        {
            //ここから
 
            int x = ReadLineToInt();
            string ans = x == 3 || x == 5 || x == 7 ? "YES" : "NO";
 
            Console.WriteLine(ans);
            Console.ReadKey();
        }
 
 
        static public void Swap<T>(ref T a,ref T b) { T temp = a;a = b;b = temp; }
        static public long GCD(int a, int b){ return b != 0 ? GCD(b, a % b) : a;}
        static public long LCM(int a, int b){ return (long)a * b / GCD(a, b); }
 
 
 
        
        static public string ReadLineToString(){return Console.ReadLine();}
        static public int ReadLineToInt(){return int.Parse(Console.ReadLine());}
        static public long ReadLineToLong() { return long.Parse(Console.ReadLine()); }
        static public string[] ReadLineToStringArray(){return Console.ReadLine().Split(' ').ToArray();}
        static public int[] ReadLineToIntArray(){return Console.ReadLine().Split(' ').Select(int.Parse).ToArray();}
        static public long[] ReadLineToLongArray() { return Console.ReadLine().Split(' ').Select(long.Parse).ToArray(); }
        static public List<string> ReadLineToStringList(){return Console.ReadLine().Split(' ').ToList();}
        static public List<int> ReadLineToIntList(){return Console.ReadLine().Split(' ').Select(int.Parse).ToList();}
        static public List<long> ReadLineToLongList() { return Console.ReadLine().Split(' ').Select(long.Parse).ToList(); }
    }
    
}

Measured memory_bytes: 11220
#include<stdio.h>
#include<string.h>
int isPrime(int n){
	int i;
	if(n==2)return 1;
	else if(n==1)return 0;
	if(n % 2 == 0)return 0;
	for(i = 3; i * i <= n; i += 2)
		if(n % i == 0)return 0;
	return 1;
}

int main(){
	int n,a,d,i,j;
	int t=0;
	while(1){
		t=0;
		scanf("%d %d %d",&a,&d,&n);
		if(!a && !d&&!n)break;
		for(i=a;1;i+=d){
			t+=isPrime(i);
			if(t==n){
				printf("%d\n",i);
				break;
			}
		}

	}
	return 0;
}

Measured memory_bytes: 0
import java.util.Scanner;

public class Main{

    public static void main(String[] args) {
        Scanner std = new Scanner(System.in);
        String str = std.next();
        int count = 0;
        for(int i = 0; i < str.length(); i++) {
            if(count == 0 && 'R' == (char)str.charAt(i))
                count++;
            if(i > 0 && str.charAt(i - 1) == str.charAt(i) && 'R' == (char)str.charAt(i))
                count++;
        }

        System.out.println(count);
    }

}

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

static const int NIL = -1;

int n;

struct Node {
	int p, l, r;
} T[30];

void preorder(int r) {
	cout << ' ' << r;
	if (T[r].l != NIL) preorder(T[r].l);
	if (T[r].r != NIL) preorder(T[r].r);
}

void inorder(int r) {
	if (T[r].l !=NIL) inorder(T[r].l);
	cout << ' ' << r;
	if (T[r].r !=NIL) inorder(T[r].r);
}

void postorder(int r) {
	if (T[r].l != NIL) postorder(T[r].l);
	if (T[r].r != NIL) postorder(T[r].r);
	cout << ' ' << r;
}

int main() {
	int r;
	cin >> n;
	for (int i = 0; i < n; i++) {
		T[i].p = T[i].l = T[i].r = NIL; //?????????
	}

	for (int i = 0; i < n; i++) {
		int id, tl, tr;
		cin >> id >> tl >> tr;
		T[id].l = tl;
		T[id].r = tr;
		T[tl].p = T[tr].p = id;
	}

	for (int i = 0; i < n; i++) {
		if (T[i].p ==NIL) r = i;
	}
	
	cout << "Preorder" << endl;
	preorder(r);
	cout << endl;
	cout << "Inorder" << endl;
	inorder(r);
	cout << endl;
	cout << "Postorder" << endl;
	postorder(r);
	cout << endl;

	return 0;
}

Measured memory_bytes: 1164
# -*- coding: utf-8 -*-
bigALlist = list('ABCDEFGHIJKLMNOPQRSTUVWXYZ')
smoALlist = list('abcdefghijklmnopqrstuvwxyz')
cnt = [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]
while True:
    try:
        text = list(input())
        for j in range(len(bigALlist)):
            for i in text:
                if (bigALlist[j] in i) or (smoALlist[j] in i):
                    cnt[j] = cnt[j] + 1
    except EOFError:
        break
for j in range(len(bigALlist)):
    print('{0} : {1}'.format(smoALlist[j],cnt[j]))


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


int main(){
    long long n, m; cin >> n >> m;
    vector<vector<long long> > A(8, vector<long long> (n));

    for(long long i = 0; i < n; i++){

        long long a, b, c; cin >> a >> b >> c;
        long long cnt = 0;
        for(long long j = -1; j <= 1; j += 2){
            for(long long k = -1; k <= 1; k += 2){
                for(long long l = -1; l <= 1; l += 2){

                    A[cnt][i] = a * j + b * k + c * l;
                    cnt++;
                }
            }
        }
    }

    for(long long i = 0; i < 8; i++){
        sort(A[i].begin(), A[i].end());
        reverse(A[i].begin(), A[i].end());        
    }

    long long ans = 0;
    for(long long i = 0; i < 8; i++){
        long long tmp = 0;

        for(long long j = 0; j < m; j++){
            tmp += A[i][j];
        }

        ans = max(ans, tmp);
    }

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

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

typedef long long LL;
typedef vector<int> VI;

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define EACH(i,c) for(__typeof((c).begin()) i=(c).begin(),i##_end=(c).end();i!=i##_end;++i)
#define eprintf(...) fprintf(stderr, __VA_ARGS__)

template<class T> inline void amin(T &x, const T &y) { if (y<x) x=y; }
template<class T> inline void amax(T &x, const T &y) { if (x<y) x=y; }
template<class Iter> void rprintf(const char *fmt, Iter begin, Iter end) {
    for (bool sp=0; begin!=end; ++begin) { if (sp) putchar(' '); else sp = true; printf(fmt, *begin); }
    putchar('\n');
}

VI ME(const VI &a, const VI &b) {
    VI ret; ret.reserve(a.size() + b.size());
    int i = 0, j = 0;
    while (i < (int)a.size() && j < (int)b.size()) {
	if (a[i] < b[j]) ret.push_back(b[j++]);
	else ret.push_back(a[i++]);
    }
    ret.insert(ret.end(), a.begin()+i, a.end());
    ret.insert(ret.end(), b.begin()+j, b.end());
    return ret;
}

int N;
int A[2011];
bool use[2011];

VI F[2011];
VI R[200011];
VI P;

int D[200011], cnt;
VI rec(int s, int last) {
    if (A[s] == 1) {
	use[s] = true;
	return { 1 };
    }

    VI vs;
    cnt++;
    vs.push_back(s);
    for (int i=0; i<(int)vs.size(); i++) {
	int v = vs[i];
	EACH (e, F[v]) if (D[*e] != cnt) {
	    D[*e] = cnt;
	    EACH (f, R[*e]) if (!use[*f]) {
		vs.push_back(*f);
	    }
	}
    }

    int pick = -1;
    EACH (e, vs) if (__gcd(last, A[*e]) > 1) {
	if (pick == -1 || A[pick] > A[*e]) {
	    pick = *e;
	}
    }

    // pick;
    use[pick] = true;
    VI cur;
    EACH (e, vs) if (!use[*e]) {
	VI tmp = rec(*e, A[pick]);
	cur = ME(cur, tmp);
    }
    
    cur.insert(cur.begin(), A[pick]);
    return cur;
}


void MAIN() {
    scanf("%d", &N);
    REP (i, N) scanf("%d", A+i);

    REP (i, N) {
	int m = A[i];
	for (int j=2; j*j<=m; j++) {
	    if (m % j == 0) {
		P.push_back(j);
		F[i].push_back(j);
		while (m % j == 0) m /= j;
	    }
	}
	if (m > 1) {
	    P.push_back(m);
	    F[i].push_back(m);
	}
    }

    sort(P.begin(), P.end());
    P.erase(unique(P.begin(), P.end()), P.end());
    REP (i, N) {
	EACH (e, F[i]) {
	    *e = lower_bound(P.begin(), P.end(), *e) - P.begin();
	    R[*e].push_back(i);
	}
    }

    VI ans;

    REP (i, N) if (!use[i]) {
	VI tmp = rec(i, 0);
	ans = ME(ans, tmp);
    }
    rprintf("%d", ans.begin(), ans.end());
}

int main() {
    int TC = 1;
//    scanf("%d", &TC);
    REP (tc, TC) MAIN();
    return 0;
}



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

//typedef
//------------------------------------------
typedef long long LL;
typedef vector<LL> VL;
typedef vector<VL> VVL;
typedef vector<string> VS;
typedef pair<LL, LL> PLL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);
const int MOD = 1000000007;

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

//main code

int main(int argc, char const* argv[])
{
    int n,m;
    cin >> n >> m;
    if (abs(n-m) > 1) {
        cout << 0 << endl;
        return 0;
    }
    LL n_fact = 1;
    LL m_fact = 1;
    for (LL i = 1; i <= n; i++) {
        n_fact *= i;
        n_fact %= MOD;
    }
    for (int i = 1; i <= m; i++) {
        m_fact *= i;
        m_fact %= MOD;
    }
    LL ans = (n_fact * m_fact) % MOD;
    if (abs(n-m) == 1) {
        cout << ans << endl;
    }
    else {
       cout << (ans * 2) % MOD << endl; 
    }
    return 0;
}


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

#define d(x) cerr << #x ":" << x << endl;
#define dd(x, y) cerr << "(" #x "," #y "):(" << x << "," << y << ")" << endl
#define rep(i, n) for (int i = (int)(0); i < (int)(n); i++)
#define all(v) v.begin(), v.end()
#define dump(v)                  \
    cerr << #v ":[ ";            \
    for (auto macro_vi : v) {    \
        cerr << macro_vi << " "; \
    }                            \
    cerr << "]" << endl;
#define ddump(v)                           \
    cerr << #v ":" << endl;                \
    for (auto macro_row : v) {             \
        cerr << "[";                       \
        for (auto macro__vi : macro_row) { \
            cerr << macro__vi << " ";      \
        }                                  \
        cerr << "]" << endl;               \
    }
using lint       = long long;
const int INF    = 1e9;
const lint LINF  = 1e18;
const double EPS = 1e-10;

int main() {
    lint N, K;
    cin >> N >> K;

    vector<lint> P(N), C(N);
    rep(i, N) {
        cin >> P[i];
        P[i]--;
    }
    rep(i, N) cin >> C[i];
    // dump(P);
    // dump(C);

    vector<pair<lint, lint>> G(N);
    rep(i, N) { G[i] = {P[i], C[P[i]]}; }
    // rep(i, N) { cout << G[i].first << ' ' << G[i].second << endl; }

    lint Ma = -LINF;
    rep(start, N) {
        vector<lint> liner(0);
        vector<bool> check(N, false);
        check[start] = true;

        int cn = start;
        while (true) {
            int nn = G[cn].first;
            int nc = G[cn].second;

            liner.push_back(nc);

            if (check[nn] == false) {
                check[nn] = true;
                cn        = nn;
                continue;
            } else {
                break;
            }
        }

        vector<lint> L(liner.size() + 1, 0);
        rep(i, liner.size()) { L[i + 1] = L[i] + liner[i]; }

        lint edges     = liner.size();
        lint cycle_sum = L.back();

        lint ma = -LINF;
        for (int i = 1; i <= min(edges, K); i++) {
            lint score  = L[i];
            lint nokori = K - i;
            if (cycle_sum > 0) { score += (nokori / edges) * cycle_sum; }

            ma = max(ma, score);
        }
        Ma = max(Ma, ma);

        // d(start);
        // dump(liner);
        // dump(L);
        // d(cycle_sum);
        // d(ma);
    }

    cout << Ma << endl;
    return 0;
}

Measured memory_bytes: 3904
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
//---------------------------------------------------------------------------------------------------
/*---------------------------------------------------------------------------------------------------
　　　　　　　　　　　 ∧＿∧  
　　　　　 ∧＿∧ 　（´<_｀ ）　 Welcome to My Coding Space!
　　　　 （ ´_ゝ`）　/　 ⌒i     
　　　　／　　　＼　 　  |　|     
　　　 /　　 /￣￣￣￣/　　|  
　 ＿_(__ﾆつ/　    ＿/ .| .|＿＿＿＿  
　 　　　＼/＿＿＿＿/　（u　⊃  
---------------------------------------------------------------------------------------------------*/


int N, C;
int imos[30][101010];
//---------------------------------------------------------------------------------------------------
void _main() {
    cin >> N >> C;
    rep(i, 0, N) {
        int a, b, c; cin >> a >> b >> c;
        a--; c--;
        imos[c][a]++;
        imos[c][b]--;
    }
    rep(c, 0, C) rep(i, 1, 101010) imos[c][i] += imos[c][i - 1];
    rep(c, 0, C) rep(i, 0, 101010) if (imos[c][i]) imos[c][i] = 1;
    //rep(c, 0, C) rep(i, 0, 101010 - 1) if (imos[c][i] == 1 and imos[c][i + 1] == 0) imos[c][i] = 0;

    //rep(c, 0, C) { rep(i, 0, 20) printf("%d ", imos[c][i]); printf("\n"); }
    

    int ans = 0;
    rep(i, 0, 101010) {
        int cnt = 0;
        rep(c, 0, C) cnt += imos[c][i];
        ans = max(ans, cnt);
    }
    cout << ans << endl;
}

Measured memory_bytes: 12160
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for (int i=0;i<(n);i++)
//#define int long long  
int main(){
    int N,K;
    int Ans=0;
    int l[52];
    cin >> N >> K;
    REP(i,N){cin >> l[i];}
    sort(l,l+N);
    REP(i,K){Ans+=l[N-i-1];}
    cout << Ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <unordered_map>
#include <functional>
#include <map>
#include <string>
using namespace std;
#define INF 1000000000;
#define MOD 1000000007;
typedef long long int ll;
int main(void){
    int n,x;
    cin>>n>>x;
    vector<int>l(n);
    int crnt=0;
    for(int i=0;i<n;i++){
        cin>>l[i];
    }  
    int ans=0;
    for(int i=0;i<n;i++){

        //crnt+=l[i];
        if(crnt<=x){
            ans++;
        }else{
            break;
        }
        crnt+=l[i];
    }
    if(crnt<=x)ans++;
    cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long
#define N 100010
using namespace std;
const int INF = 1LL<<55;
const int mod = (1e9)+7;
const double EPS = 1e-8;
const double PI = 6.0 * asin(0.5);
template<class T> T Max(T &a,T b){return a=max(a,b);}
template<class T> T Min(T &a,T b){return a=min(a,b);}
struct dat{
  double x,y,r;
  bool operator < (const dat a)const {return r < a.r;}
};
dat neko,rat;

double getDis(dat a,dat b){return sqrt((a.x - b.x)*(a.x - b.x) + (a.y - b.y)*(a.y - b.y));}
bool intersect(dat a,dat b){return getDis(a,b) <= a.r + b.r;}


vector<int>  DP(vector<dat>&A){
  int n = A.size();
  vector<int> dp(n,1);
  for(int i=0;i<n;i++) //next use
    for(int j=0;j<i;j++){ //pre use
      if(intersect(A[i],A[j]) && getDis(A[i],A[j])+min(A[i].r,A[j].r) >= max(A[i].r,A[j].r)) continue;      Max(dp[i],dp[j]+1);
    }

  return dp;
}

signed main(){
  while(1){
    int nn;
    cin>>nn;
    if(nn == 0) break;
    cin>>neko.x>>neko.y; neko.r = 0;
    cin>>rat.x>>rat.y; rat.r = 0;
  
    vector<dat> Neko,Rat;
    for(int i=0;i<nn;i++){
      dat wall;
      cin >>wall.x>>wall.y>>wall.r;
      if(intersect(wall,neko) == intersect(wall,rat)) i--,nn--;
      else if(intersect(wall,neko)) Neko.push_back(wall);
      else if(intersect(wall,rat)) Rat.push_back(wall);
    }
  
    sort(Neko.begin(),Neko.end());
    sort(Rat.begin(),Rat.end());
    
    vector<int> ndp = DP(Neko);
    vector<int> rdp = DP(Rat);
    int ans = 0, n = Neko.size(), m = Rat.size();
    
    for(int a:ndp) Max(ans,a);
    for(int a:rdp) Max(ans,a);

    for(int i=0;i<n;i++)
      for(int j=0;j<m;j++)
        if(!intersect(Neko[i],Rat[j])) Max(ans,ndp[i] + rdp[j]);
    cout<<ans<<endl;
  }
  return 0;
}

Measured memory_bytes: 3260
/* بِسْمِ اللَّهِ الرَّحْمَٰنِ الرَّحِيمِ */
//codeforces
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
#define FASTIO ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
#define mp make_pair
#define pb push_back
#define sz(v) ((int)v.size())
#define all(v) v.begin(), v.end()
void parseArray(ll* A,ll n){ for ( ll K = 0; K < n; K++){ cin >> A[K]; } }
ll modInverse(ll a, ll b){ return 1<a ? b - modInverse(b%a,a)*b/a : 1; }
ll gcd(ll a, ll b){ return b?gcd(b, a % b):a; }
ll lcm(ll a, ll b){ return (a*b)/gcd(a, b); }
ld dist(ld x, ld y, ld a, ld b){ return sqrt((x - a)*(x - a) + (y - b)*(y - b)); }
void debug(ll* a, ll n) { for ( ll k = 0; k < n; k++ ){ cout << a[k] << " ";} cout << "\n"; }
#define PI 3.14159265358979323846

ll n;
vector<string> ans;
void f(string s, int x, int idx) {
	if (idx == n) {
		//cout << s << "\n";
		ans.pb(s);
		return ;
	}
	for ( int k = 0; k <= min(x + 1, idx); k++ )
		f(s + (char)('a' + k), max(x, k), idx + 1);
}

int main(){
	FASTIO;
	cin >> n;
	f("", 0, 0);
	sort(all(ans));
	for (string s : ans)
		cout << s << "\n";
	return 0;
}

Measured memory_bytes: 7796
#include<stdio.h>
int main()
{
	int n,a,b,c,d;
	int i;
	while(scanf("%d",&n)!=EOF){
	i=0;
		for(a=0;a<10;a++){
			for(b=0;b<10;b++){
				for(c=0;c<10;c++){
					for(d=0;d<10;d++){
						if(a+b+c+d==n){
							i++;
							}	
						}
					}
				}
			}
			printf("%d\n",i);
		}
		return 0;
	}

Measured memory_bytes: 596
import sys

A, B = map(int, sys.stdin.readline().split())


if 0 < A:
    print "Positive"
elif A <= 0 and 0 <= B:
    print "Zero"
else:
    if (B-A+1) % 2 == 0:
        print "Positive"
    else:
        print "Negative"



Measured memory_bytes: 2568
#include<iostream>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<map>

using namespace std;

int main()
{
    int N;
    cin >> N;
    int T, A;
    cin >> T >> A;

    int min = 0;
    int result = 0;
    for (int i = 1; i <= N; i++) {
        int H = 0;
        cin >> H;
        int diff = abs((T * 1000 - H * 6) - A * 1000);
        if (i == 1 || diff < min) {
            min = diff;
            result = i;
        }
    }

    cout << result << endl;

    return 0;
}


Measured memory_bytes: 256
N = int(input())
d = dict()

def calc(x, y, z):
    return x ** 2 + y ** 2 + z ** 2 + x * y + y * z + z * x

import math
sn = int(math.sqrt(N))

for x in range(1, sn + 2):
    for y in range(1, sn + 2):
        for z in range(1, sn + 2):
            n = calc(x, y, z)
            if n in d:
                d[n] += 1
            else:
                d[n] = 1

for i in range(1, N+1):
    if i in d:
        print(d[i])
    else:
        print(0)

Measured memory_bytes: 11284
#include <bits/stdc++.h>
using namespace std;
#define rep(i,cc,n) for(int i=cc;i<n;++i)
#define lrep(i,cc,n) for(long long i=cc;i<n;++i)
#define rrep(i,cc,n) for(long i=cc;i>n;--i)
#define pii pair<int, int>
#define pll pair<long long, long long>
 
using ll = long long;
const ll inf = 1001001001;
const ll mod = 1000000007;
 
int main() {
    int n;
    cin >> n;
    string s;
    cin >> s;
    string ans = s;
    int p=0;
    rep(i, 0, n){
        if(s[i] == '(')p++;
        else p--;
        if(p < 0){
            ans = '(' +ans;
            p++; 
        }
        if(i == n-1 && p > 0){
            int j = p;
            while(p > 0){
                ans += ')';
                p--;
            }
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(void)
{
	int n,i,sum;
	scanf("%d",&n);
	sum=100000;
	for(i=1;i<=n;i++){
		sum=sum*1.05;
		if(sum%1000==0){
		}
		else{
			sum=(sum/1000)*1000+1000;
		}
	}
	printf("%d\n",sum);
	return 0;
}



Measured memory_bytes: 2040
//#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>
#define PI 3.14159265359
using namespace std;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
const long long INF= 1e+18+1;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll> >vvl;
typedef pair<ll,ll> P;
typedef tuple<ll,ll,ll> T;
const ll MOD=1000000007LL;
string abc="abcdefghijklmnopqrstuvwxyz";
string ABC="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
int main(){
  ll n,m;cin>>n>>m;
  vector<bool>red(n,false);
  red[0]=true;
  vector<ll>count(n,1);
  rep(i,m){
    ll x,y;cin>>x>>y;
    x--;y--;
    count[x]--;count[y]++;
    if(red[x])red[y]=true;
    if(count[x]==0)red[x]=false;
  }
  ll ans=0;
  rep(i,n){
    if(red[i])ans++;
  }
  cout<<ans<<endl;
}

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

// Begin {{{
using namespace std;

#define all(x) x.begin(), x.end()
#define rep(i, n) for (i64 i = 0; i < (n); ++i)
#define reps(i, s, n) for (i64 i = (s); i <= (n); ++i)
#define VAR(Type, ...) Type __VA_ARGS__; IN(__VA_ARGS__)
#define Float(x) OUTN(fixed, setprecision(x));

using i64 = int_fast64_t;
using pii = pair<i64, i64>;

template<class A, class B>
inline bool chmax(A &a, const B &b) { return b > a && (a = b, true); }

template<class A, class B>
inline bool chmin(A &a, const B &b) { return b < a && (a = b, true); }

constexpr int INF = 0x3f3f3f3f;
constexpr i64 LINF = 0x3f3f3f3f3f3f3f3fLL;
constexpr int MOD = int(1e9) + 7;

//IN
void IN() {}
template<class Head, class... Tail>
void IN(Head&& head, Tail&&... tail) {
  cin >> head;
  IN(forward<Tail>(tail)...);
}

//OUTS
template<size_t> struct int_{};
template<class Tuple, size_t Pos>
ostream& print_tuple(ostream& out, const Tuple& t, int_<Pos>) {
  out << get<tuple_size<Tuple>::value-Pos>(t) << " ";
  return print_tuple(out, t, int_<Pos-1>());
}

template <class Tuple>
ostream& print_tuple(ostream& out, const Tuple& t, int_<1>) {
  return out << get<tuple_size<Tuple>::value-1>(t);
}

template<class... Args>
ostream& operator<<(ostream& out, const tuple<Args...>& t) {
  return print_tuple(out, t, int_<sizeof...(Args)>());
}

#define OUTS(...) cout << make_tuple(__VA_ARGS__) << "\n";

//OUTL
void OUTL() {}
template<class Head, class... Tail>
void OUTL(Head&& head, Tail&&... tail) {
  cout << head << "\n";
  OUTL(forward<Tail>(tail)...);
}

//OUTN
void OUTN() {}
template<class Head, class... Tail>
void OUTN(Head&& head, Tail&&... tail) {
  cout << head;
  OUTN(forward<Tail>(tail)...);
}
// }}} End

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

  int n; string s;
  IN(n, s);

  i64 R = 0, B = 0;
  for (auto e : s) {
    if (e == 'R') ++R;
    else ++B;
  }

  OUTL((R > B) ? "Yes" : "No");

  return 0;
}


Measured memory_bytes: 256
import java.util.*;
import java.lang.*;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int A = sc.nextInt();
        int B = sc.nextInt();
        int C = sc.nextInt();
        System.out.println(A+B+C-Math.max(A,Math.max(B,C)));
    }
}

Measured memory_bytes: 21844
<?php

    $N = intval(trim(fgets(STDIN)));

    $V = array_map('intval',explode(" ",trim(fgets(STDIN))));
    
    sort($V);
    
    $old=$V[0];
    $sum=0;
    
    for($i=1;$i<$N;$i++){
        
        $new = ($V[$i] + $old)/2;
        
        $old = $new;
        

    }
    echo $new;
?>

Measured memory_bytes: 16108
#include <stdio.h>

int main(void)
{
    int map[1000];
    int dx, now;
    int n, m;
    int i, j;
    int ans;
    
    while (1){
        scanf("%d%d", &n, &m);
        
        if (n + m == 0){
            break;
        }
        
        for (i = 0; i < n; i++){
            scanf("%d", &map[i]);
        }
        
        now = ans = 0;
        
        for (i = 0; i < m; i++){
            scanf("%d", &dx);
            if (now < n){
                now += dx + map[(now + dx) < n ? now + dx : 0];
                ans++;
            }
        }
        
        printf("%d\n", ans);
    }
    
    return (0);
}

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

using namespace std;

int main()
{
  int n, c, sum = 0;
  cin >> n >> c;
  for (int i = 0; i < c; i++)
  {
    int p;
    cin >> p;
    sum += p;
  }
  cout << (sum + n) / (n + 1) << endl;

  return 0;
}



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

int main() {
  long long n;
  cin >> n;
  long long ans=1e15;
  for(long long i=1;i*i<=n;i++){
     if(n%i==0){
     long long j=n/i;
     ans=min(i+j-2,ans);
     }
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
import sys
from io import StringIO
import unittest

def resolve():
    a, b, c, d = map(int, input().split())
    print(max([a*c,a*d,b*c,b*d]))

class TestClass(unittest.TestCase):
    def assertIO(self, input, output):
        stdout, stdin = sys.stdout, sys.stdin
        sys.stdout, sys.stdin = StringIO(), StringIO(input)
        resolve()
        sys.stdout.seek(0)
        out = sys.stdout.read()[:-1]
        sys.stdout, sys.stdin = stdout, stdin
        self.assertEqual(out, output)

    def test_入力例_1(self):
        input = """1 2 1 1"""
        output = """2"""
        self.assertIO(input, output)

    def test_入力例_2(self):
        input = """3 5 -4 -2"""
        output = """-6"""
        self.assertIO(input, output)

    def test_入力例_3(self):
        input = """-1000000000 0 -1000000000 0"""
        output = """1000000000000000000"""
        self.assertIO(input, output)


if __name__ == "__main__":
    resolve()


Measured memory_bytes: 71072
open Scanf
open Printf

let flip f x y = f y x

let rec range a b = if a >= b then [] else a :: range (a+1) b

let read_int () = scanf " %d" (fun x -> x)
let rec read_ints n = if n = 0 then [] else let i = read_int () in i :: read_ints (n-1)

let rec for_iter a b f = if a >= b then [] else let x = f a in x :: for_iter (a+1) b f
let rec for_iter_ a b f = if a >= b then () else (f a; for_iter_ (a+1) b f)

let () =
  let count = Array.make 100010 0 in
  read_int ()
  |> read_ints
  |> List.iter (fun x ->
      count.(x) <- count.(x) + 1;
      count.(x+1) <- count.(x+1) + 1;
      if x > 0 then count.(x-1) <- count.(x-1) + 1);
  Array.fold_left max 0 count
  |> printf "%d\n"



Measured memory_bytes: 8576
#include<iostream>
#include<vector>
#include<algorithm>//sort,二分探査など
//#include<bitset>
//#include<cmath>//pow,logなど
//#include<deque>
//#include<functional>
//#include<iterator>
//#include<map>
#include<numeric>//gcd,lcm
//#include<queue>
//#include<set>
//#include<stack>
//#include<string>
//#include<utility>//pair

//QCFium法
#pragma GCC target("avx")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")

//浮動小数点処理高速化
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

using namespace std;
using i64 = int64_t;
using f80 = __float80;
using u64 = uint_fast64_t;

constexpr i64 INF = 1010000000000000017LL;
constexpr u64 MOD = 1000000007LL;
constexpr f80 PI = 3.14159265358979323846;

#define _overload3(_1,_2,_3,name,...) name
#define repi(i,start,end) for(int i=(int)(start);i<(int)(end);++i)
#define _rep(i,n) repi(i,0,n)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define rrep(i,start,end) for(int i=(int)(start);i>(int)(end);--i)
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()

#define v(T) vector<T>
#define vv(T) v(v(T))
#define vvv(T) v(v(v(T)))
typedef v(int) vi;

#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >

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

template<typename T> ostream &operator<<(ostream &os, const vector< T > &v){
  rep(i,v.size()) os << v[i] << (i + 1 != v.size() ? " " : "");
  return os;
}
template<typename T> istream &operator>>(istream &is, vector< T > &v){
  for(T &in : v) is >> in;
  return is;
}

void Main()
{
  int N;
  cin >> N;
  bool flagP = true;
  bool flagS = false;

  vector<int> A(N);
  cin >> A;

  int gcdx = A[0];
  rep(i, 1, N) {
    gcdx = __gcd(gcdx, A[i]);
    if(gcdx==1) {
      flagS = true;
    }
  }

  vector<int> prime(1000001, 1);
  for(int i = 2; i <= 1000; i++) {
    if(prime[i] == 1) {
      int x = i * 2;
      while(x <= 1000000){
        prime[x] = i;
        x += i;
      }
    }
  }

  vector<bool> elatos(1000001, false);

  rep(i,N){
    int x = A[i];
    while(x > 1){
      int p;
      if(prime[x] == 1) {
        p = x;
      } else {
        p = prime[x];
      }
      if(elatos[p]) {
        flagP = false;
        break;
      }
      elatos[p] = true;
      while(x > 1 and x % p == 0){
        x /= p;
      }
    }
    if(flagP == false) {
      break;
    }
  }

  if(flagP) {
    cout << "pairwise coprime\n";
    return;
  }

  if(flagS) {
    cout << "setwise coprime\n";
    return;
  }

  cout << "not coprime\n";
}

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

Measured memory_bytes: 11364
while True :
	try:
		x=[int(i) for i in input().split(",")]
		Len=x[:-2]
		ve=x[len(x)-2:]
		sum_ve=sum(ve)
		k=sum(Len)/sum_ve
		count=0
		for i in range(len(Len)):
			count+=Len[i]
			if count>=k*ve[0]:
				print(i+1)
				break
	except EOFError:
		break


Measured memory_bytes: 5604
n = int(input())

ans = [0] * (n+1)
for x in range(100):
    for y in range(100):
        for z in range(100):
            m = x**2 + y**2 + z**2 + x*y + y*z + z*x
            if 1 <= x * y * z and 0 <= m <= n:
                ans[m] += 1

for i in range(n):
    print(ans[i+1])

Measured memory_bytes: 9144
/**
*   @Author : MeGaCrazy
*   @InitTime : Sat Dec 29 15:26:12 2018
*   @Idea :
*
*
*
*
*
*  Happy Solving :)
**/
#include <bits/stdc++.h>
using namespace std;
int n;

long long cal(string v){
//	cerr<<v<<endl;
	long long ret=0;
	long long cur=0;
	for(int i=0;i<v.size();i++){
		if(v[i]=='+'){
		   ret+=cur;
		   cur=0;
		}else{
		    cur=(cur*10)+(v[i]-'0');
		}
	}
	return ret;
}
string s;
long long solve(int idx,string v){
	if(idx==n){
		return cal(v+"+");
	}
	
	long long ret=solve(idx+1,v+s[idx]);
	ret+=solve(idx+1,v+"+"+s[idx]);
	return ret;

}
int main(){
#ifndef ONLINE_JUDGE
 //  freopen("in","r",stdin);
   //freopen("out","w",stdout);
#endif

    cin>>s;
    n=s.size();
    printf("%lld",solve(1,string(1,s[0])));


}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define endl "\n"

using namespace std;

int main(){
    int a, temp, len, sum=0;
    cin >> a;
    len=log10(a)+1;
    temp=a;
    for(int i=0; i<len; i++){
        sum+=temp%10;
        temp/=10;
    }
    cout << (a%sum==0? "Yes":"No") << endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll                 long long int
#define mod                1000000007
#define pi                 3.14159265358979323846264338327950288419716939937510
#define setbit(x)          __builtin_popcountll(x)
#define db                 long double
#define pp(x)              pair<x,x>
#define ff                 first
#define ss                 second
#define FIO                ios_base::sync_with_stdio(false); cin.tie(NULL);
#define tc                 ll tc; cin>>tc; for(ll number = 1 ; number <= tc ; number ++ )
#define vv(x)              vector<x>
#define pb                 push_back
#define pob                pop_back
#define pf                 push_front
#define pof                pop_front
#define endl               "\n"
#define pq                 priority_queue
#define dbg(x)             { cout<< #x << ": " << (x) << endl; }
#define dbg2(x,y)          { cout<< #x << ": " << (x) << " , " << #y << ": " << (y) << endl; }
#define bp                 ll kkk; cin >>kkk;
#define dbgArr(a,n)        cout<<"Array "<<#a<<endl; for(ll i=0 ; i<n ; i++) cout<<a[i]<<" "; cout<<endl;
#define maxE(a,n)          *max_element(a,a+n);
#define minE(a,n)          *min_element(a,a+n);
#define forn(i,s,n)        for(ll i=s ; i<n ; i++)
#define fornr(i,e,s)       for(ll i=e-1 ; i>=s ; i--)
#define arr1(a,n)          for(ll i=1;i<=n;i++){ cin>>a[i]; }
#define file freopen("input.txt","r",stdin); freopen("output.txt","w",stdout)
#define print cout<<"Case #"<<number<<": "
#define all(x) x.begin(), x.end()
ll power(ll x, ll b) {ll p = 1;while (b > 0) {if(b&1) {p = p * x; p %= mod;} b >>= 1; x *= x; x %= mod;} return p % mod;}
using namespace std;
# define INF 1e15

struct lex_compare {
    bool operator() (pp(ll) p1,pp(ll) p2){
        ll x1 = (p1.ff*(p1.ss-p1.ss/2));
        ll x2 = (p2.ff*(p2.ss-p2.ss/2));
        return x1 > x2;
    }
};

ll dfs(ll src, vv(vv(ll)) &e, bool vis[]){
    ll ans = 1;
    vis[src] = 1;
    for(auto i : e[src]){
        if(!vis[i]){
            ans += dfs(i,e,vis);
        }
    }
    return ans;
}

ll freq[1000001];
bool vis[1000001];
int main(){
    FIO;
    ll n; cin >> n;
    ll arr[n];
    forn(i,0,n) cin >> arr[i];
    ll gc = arr[0];
    for(int i = 1;i<n;i++) gc = __gcd(arr[i],gc);
    if(gc != 1){
        cout << "not coprime" << endl;
        return 0;
    }
    memset(freq,0,sizeof(freq));
    sort(arr,arr+n);
    forn(i,0,n) freq[arr[i]]++;
    bool f = 1;
    memset(vis,0,sizeof(vis));
    for(int i = 2;i<=1000000;i++){
        if(freq[i] > 1){
            f = 0;
            break;
        }
        if(vis[i]) continue;
        //if(freq[i] == 0) continue;
        ll sum = 0;
        for(int j = i;j<=1000000;j+=i){
            vis[j] = 1;
            sum += freq[j];
            if(sum > 1){
                f = 0;
                break;
            }

        }
        if(!f) break;
    }
    for(int i = 2;i<=1000000;i++){
        if(freq[i] > 1){
            f = 0;
            break;
        }
    }
    if(f){
        cout << "pairwise coprime" << endl;
    }else{
        cout << "setwise coprime" << endl;
    }
    return 0;
}


Measured memory_bytes: 20240
import Data.Bool   (bool)
import Data.List   (isPrefixOf, stripPrefix)
import Data.Maybe  (isJust)
import Data.Monoid (First (First, getFirst), (<>))

main :: IO ()
main = do
    s <- getLine
    answer $ solve s

type Answer = Bool
answer :: Answer -> IO ()
answer = putStrLn . bool "NO" "YES"

solve :: String -> Answer
solve = isJust . inner False
  where
    inner dream s
      | null s    = return ()
      | otherwise = do
        let
          prefices = ["dream", "eraser", "erase"]
          dreamer  = First $ bool Nothing (stripPrefix "er" s) dream
        suffix <- getFirst $ foldMap (First . flip stripPrefix s) prefices <> dreamer
        inner ("dream" `isPrefixOf` s) suffix


Measured memory_bytes: 4988
#coding:utf-8
import sys
sys.setrecursionlimit(10**6)
write = sys.stdout.write
dbg = lambda *something : print(*something) if DEBUG else 0
DEBUG = True
def main(given = sys.stdin.readline):
    input = lambda : given().rstrip()
    LMIIS = lambda : list(map(int,input().split()))
    II = lambda : int(input())
    XLMIIS = lambda x : [LMIIS() for _ in range(x)]

    n, k = LMIIS()
    a = LMIIS()
    f = LMIIS()
    a.sort(reverse=True)
    f.sort()


    max_ = 10**12
    min_ = 0

    while max_ != min_ + 1:
        x = (max_ + min_) // 2
        shugyo = 0
        for i in range(n):
            shugyo += max(0, a[i] - x // f[i])

        if shugyo <= k:
            max_ = x
        else:
            min_ = x


    if x == min_:
        x += 1
    if sum(a) <= k:
        x = 0
    print(x)

if __name__ == '__main__':
    main()


Measured memory_bytes: 113280
#include <iostream>
#include <algorithm>
#include<cmath>
#include<cstring>
#include<cstdio>
#include<cstdlib>
#include<vector>
#include<iomanip>
#include<ctime>
#include<set>
#include<map>
#include<queue>
#include<stack>
#define sqr(x) ((x)*(x))
#define fz1(i,n) for ((i)=1;(i)<=(n);(i)++)
#define fd1(i,n) for ((i)=(n);(i)>=1;(i)--)
#define fz0g(i,n) for ((i)=0;(i)<=(n);(i)++)
#define fd0g(i,n) for ((i)=(n);(i)>=0;(i)--)
#define fz0k(i,n) for ((i)=0;(i)<(n);(i)++)
#define fd0k(i,n) for ((i)=(long long)((n)-1);(i)>=0;(i)--)
#define fz(i,x,y) for ((i)=(x);(i)<=(y);(i)++)
#define fd(i,y,x) for ((i)=(y);(i)>=(x);(i)--)
#define fzin fz1(i,n)
#define fzim fz1(i,m)
#define fzjn fz1(j,n)
#define fzjm fz1(j,m)
#define ff(c,itr) for (__typeof((c).begin()) itr=(c).begin();itr!=(c).end();itr++)
#define rdst(st,len){static char ss[len];scanf(" %s",ss);(st)=ss;}
#define inc(x,y) {x+=(y);if(x>=mod)x-=mod;}
#define dec(x,y) {x-=(y);if(x<0)x+=mod;}
using namespace std;
int n,m,i,j,mi,mx,cnt[105];
int main()
{
	scanf("%d",&n);
	fz1(i,n){
		int x;
		scanf("%d",&x);
		cnt[x]++;
	}
	fz1(i,n){
		if(cnt[i]){
			if(!mi) mi=i;
			mx=i;
		}
	}
	if(cnt[mi]>2){
		puts("Impossible");
		return 0;
	}
	if(cnt[mi]==1&&mi*2!=mx){
		puts("Impossible");
		return 0;
	}
	if(cnt[mi]==2&&mi*2-1!=mx){
		puts("Impossible");
		return 0;
	}
	for(i=mi+1;i<=mx;i++){
		if(cnt[i]<2){
			puts("Impossible");
			return 0;
		}
	}
	puts("Possible");
	return 0;
}

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

vector<int> seen;

void dfs(int i, vector<vector<int>> &friends, int k) {
  seen.at(i) = k;
  for(int j = 0; j < friends.at(i).size(); j++) {
    if(seen.at(friends.at(i).at(j)) == k) {
      continue;
    }
    dfs(friends.at(i).at(j), friends, k);
  }
}
  

int main() {
  int N, M, K;
  cin >> N >> M >> K;
  vector<vector<int>> friends(N);
  vector<vector<int>> block(N);
  map<int, int> mp;
  for(int i = 0; i < M; i++) {
    int a, b;
    cin >> a >> b;
    friends.at(a - 1).push_back(b - 1);
    friends.at(b - 1).push_back(a - 1);
  }
  for(int i = 0; i < K; i++) {
    int c, d;
    cin >> c >> d;
    block.at(c - 1).push_back(d - 1);
    block.at(d - 1).push_back(c - 1);
  }
  seen.assign(N, 0);
  int k = 1;
  for(int i = 0; i < N; i++) {
    if(seen.at(i)) {
      continue;
    }
    dfs(i, friends, k);
    k++;
  }
  for(int i = 0; i < N; i++) {
    mp[seen.at(i)]++;
  }
  for(int i = 0; i < N; i++) {
    int ans = mp.at(seen.at(i));
    for(int j = 0; j < friends.at(i).size(); j++) {
      if(seen.at(i) == seen.at(friends.at(i).at(j))) {
        ans--;
      }
    }
    for(int k = 0; k < block.at(i).size(); k++) {
      if(seen.at(i) == seen.at(block.at(i).at(k))) {
        ans--;
      }
    }
    ans--;
    cout << ans << " ";
  }
  cout << endl;
}

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

namespace AOJV0
{
    public class P0000
    {
        public static void Main()
        {
            foreach(var s in from x in Enumerable.Range(1,9)
                             from y in Enumerable.Range(1,9)
                             select string.Format("{0}x{1}={2}", x, y, x * y))
            {
                Console.WriteLine(s);
            }                    
        }
    }
}

Measured memory_bytes: 5836
#include<bits/stdc++.h>
#include<numeric>
using namespace std;
#define ll  long long
#define mp make_pair
#define fi first
#define se second
#define pii pair<ll,ll>
#define pb push_back
#define io ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define what_is(x) cerr << #x << " is " << x << endl;
#define mod 1000000007
int edge[8][8];int ans=0;
int vis[8];int n,m;
void dfs(int v,int count)
{
    if(count==n-1)
    {
        int temp=0;
        for(int i=0;i<n;i++)
        {
            if(vis[i])
            temp++;
        }
        if(temp==n)
        ans++;
        return;
    }
    for(int i=0;i<n;i++)
    {
        if(!vis[i]&&edge[v][i])
        {
            vis[i]=1;
            dfs(i,count+1);
            vis[i]=0;
        }
    }
}
int main()
{
    int u,v;
    cin >> n >> m ;
    for(int i=0;i<m;i++)
    {
        cin >> u >> v;
        u--;
        v--;
        edge[u][v]=1;
        edge[v][u]=1;
    }
    vis[0]=1;
    dfs(0,0);
    cout << ans;
}

Measured memory_bytes: 256
<?php
    fscanf(STDIN, "%s", $s);
    $result = '';
    if($s === 'Sunny'){
        $result = 'Cloudy';
    }elseif($s === 'Cloudy'){
        $result =  'Rainy';
    }else{
        $result = 'Sunny';
    }
    echo $result;
  ?>

Measured memory_bytes: 3700
#include <stdio.h>

int main(void)
{
    int N, M, X, Y;
    int x_max = -100, x, y_min = 100, y;
    int i;
    
    scanf("%d %d %d %d", &N, &M, &X, &Y);
    for(i = 0; i < N; i++){
        scanf("%d%*c", &x);
        if(x > x_max) x_max = x;
    }
    for(i = 0; i < M; i++){
        scanf("%d%*c", &y);
        if(y < y_min)y_min = y;
    }
    if(x_max < y_min && x_max < Y && X <y_min){
        printf("No War\n");
    }else{
        printf("War\n");
    }
    
    return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
// const bool debug=true;
const bool debug=false;
#define DEBUG if(debug==true)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const ll MOD = 1000000007;

int main(void) {
    ll n,m;
    cin>>n>>m;
    ll time=1900*m+100*(n-m);
    cout << ((1LL<<m)*time) << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main(){
  int n, k;
  vector<long long> v;
  cin >> n >> k;
  int h;
  for(int i=0; i<n; i++){
    cin >> h;
    v.push_back(h);
  }
  sort(v.begin(), v.end());
  long long sum=0;
  for(int i=0; i<n-k; i++){
    sum+=v[i];
  }
  cout << sum;
  return 0;
}

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

#define FOR(i, j, k) for(int i=j ; i<k ; i++)
#define REP(i, j) FOR(i, 0, j)
typedef long long int ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vi> vvi;

void rec(ll x) {

    if (x == 0) return;
    cout << x << " ";

    if (x > 0) {
        REP(i, 16) {
            ll t = 1 << (i * 2);
            cout << t << " ";
            if (x <= t) {
                x -= t;
                cout << i * 2 << endl;
                break;
            }
        }
    } else if (x < 0) {
        REP(i, 16) {
            ll t = - (1 << (i * 2 + 1));
            cout << t << " ";
            if (x >= t) {
                x -= t;
                cout << i * 2 + 1 << endl;
                break;
            }
        }
    }

    rec(x);
}

int main() {

    int N; cin >> N;

    vector<ll> minus, plus;
    REP(i, (1 << 17)) {
        ll m = 0, p = 0;
        int t = i, tt = i;

        for(int j = 16; j >= 0; j--) {
            if ((t >> j) & 1) {
                t -= 1 << j;
                p += (1LL << (j * 2));
            }
        }

        for(int j = 16; j >= 0; j--) {
            if ((tt >> j) & 1) {
                tt -= 1 << j;
                m += (1LL << (j * 2 + 1));
            }
        }
        minus.push_back(m);
        plus.push_back(p);
    }

    // REP(i, minus.size()) cout << minus[i] << endl;

    ll u, l;
    if (N < 0) {
        REP(i, minus.size()) {
            l = minus[i];
            u = *(lower_bound(plus.begin(), plus.end(), N + l));
            if (u - l == N) break;
        }
    } else {
        REP(i, plus.size()) {
            u = plus[i];
            l = *(lower_bound(minus.begin(), minus.end(), u - N));
            if (u - l == N) break;
        }
    }

    int imax = 0;
    vector<int> res(32, 0);
    for (int i = 32; i >= 0; i--) {
        if (i%2 == 0) {
            if (u >= (1LL << i)) {
                u -= (1LL << i);
                res[i] = 1;
                imax = max(imax, i);
            }
        } else {
            if (l >= (1LL << i)) {
                l -= (1LL << i);
                res[i] = 1;
                imax = max(imax, i);
            }
        }
    }

    REP(i, imax + 1) cout << res[imax - i];
    cout << endl;

    return 0;
}


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

int main(){
  float n,ans,array[1000];
  float minsa=10000000,heikin=0;
  cin>>n;
  for(int i=0;i<n;i++){
    cin>>array[i];
    heikin+=array[i];
  }
  heikin=heikin/n;
  for(int i=0;i<n;i++){
    if(abs(array[i]-heikin)<minsa){
      ans=i;
      minsa=abs(array[i]-heikin);
    }
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using vi = vector<ll>;
using vii = vector<vi>;
using Pll = pair<ll, ll>;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define all(v) v.begin(), v.end()
#define sz(x) ((int) x.size())
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define F first
#define S second
const int MOD = 1e9+7;
const int INF = 2e9;
template<class T> void print(const T& t){ cout << t << endl; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
int gcd(int a,int b){return b?gcd(b,a%b):a;}

int main(){
    ll n;
    cin >> n;
    ll ans = (n - 1) * n / 2;
    print(ans);
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
 
template<typename T1, typename T2> istream& operator>>(istream& is, pair<T1,T2>& a){ return is >> a.first >> a.second; }
template<typename T1, typename T2> ostream& operator<<(ostream& os, pair<T1,T2>& a){ return os << a.first << " "<<a.second; }
template<typename T> istream& operator>>(istream& is, vector< T >& vc){ for(int i = 0; i < vc.size(); i++) is >> vc[i]; return is; }
template<typename T> ostream& operator<<(ostream& os, vector< T >& vc){ for(int i = 0; i < vc.size(); i++) os << vc[i] << endl; return os; }
 
#define ForEach(it,c) for(__typeof (c).begin() it = (c).begin(); it != (c).end(); it++)
#define ALL(v) (v).begin(), (v).end()
#define UNQ(s) { sort(ALL(s)); (s).erase( unique( ALL(s)), (s).end());}
#define fr first
#define sc second
 
typedef pair< int , int > Pi;
typedef pair< int , Pi > Pii;
 
typedef long long int64;
const int64 INF = 1LL << 55;

void Floyd_Warshall(vector< vector< int64 > >& graph){
  for(int k = 0; k < graph.size(); k++){
    for(int i = 0; i < graph.size(); i++){
      for(int j = 0; j < graph.size(); j++){
        graph[i][j] = min( graph[i][j], graph[i][k] + graph[k][j]);
      }
    }
  }
  return ;
}

int main(){
  int N, M, R, z[1000];
  vector< vector< int64 > > Road_graph, Sea_graph;
  int64 dp[1000][200];

  while(cin >> N >> M, N){
    
    Road_graph = vector< vector< int64 > >( N, vector< int64 >( N, INF));
    Sea_graph  = vector< vector< int64 > >( N, vector< int64 >( N, INF));
    for(int i = 0; i < N; i++){
      Road_graph[i][i] = Sea_graph[i][i] = 0;
    }

    for(int i = 0; i < M; i++){
      int x, y, t;
      char sl;
      cin >> x >> y >> t >> sl;
      --x, --y;
      if(sl == 'L') Road_graph[x][y] = Road_graph[y][x] = t;
      else          Sea_graph [x][y] = Sea_graph [y][x] = t;
    }
    cin >> R;
    for(int i = 0; i < R; i++){
      cin >> z[i];
      z[i]--;
    }

    Floyd_Warshall(Road_graph);
    Floyd_Warshall( Sea_graph);

    //dp[idx][船の場所]
    fill_n( *dp, 1000 * 200, INF);
    dp[0][z[0]] = 0;
    for(int i = 0; i < R - 1; i++){
      for(int j = 0; j < N; j++){ //船の場所
        if(dp[i][j] == INF) continue;
        dp[i + 1][j] = min( dp[i + 1][j], dp[i][j] + Road_graph[z[i]][z[i + 1]]);
        for(int k = 0; k < N; k++){
          int64 Cost = Road_graph[z[i]][j] + Sea_graph[j][k] + Road_graph[k][z[i + 1]];
          if(Cost > INF) continue;
          dp[i + 1][k] = min( dp[i + 1][k], dp[i][j] + Cost);
        }
      }
    }
    int64 ret = INF;
    for(int i = 0; i < N; i++){
      ret = min( ret, dp[R - 1][i]);
    }
    cout << ret << endl;
  }
}

Measured memory_bytes: 3664
#include<stdio.h>
int main(){
	int t,h,m,s;
	scanf("%d",&t);
	h=(int)t/3600;
	m=(int)t-3600*h;
	m=(int)m/60;
	s=(int)t-3600*h-60*m;
	printf("%d:%d:%d\n",h,m,s);
	return 0;
}

Measured memory_bytes: 592