akhauriyash/Code-Regression huggingface dataset:
n = int(input())

s = [sorted(list(input())) for _ in range(n)]
s_e = [''] * n

for i in range(n):
    s_e[i] = ''.join(s[i])

s_e.sort()
#print(s_e)

count = 1
ans = 0

for i in range(n-1):
    #print(s_e[i])
    if s_e[i] == s_e[i+1]:
        count += 1
    else:
        ans += (count * (count-1) // 2)
        count = 1

if count > 1:
    ans += (count * (count-1) // 2)

print(ans)

Measured memory_bytes: 31820
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <iomanip>
#include <queue>
#include <deque>
#include <map>
#include <unordered_map>
#define rep(i,n) for(int i=0;i<n;i++)
#define repn(i,n) for(int i=1;i<=n;i++)
#define repr(e,x) for(auto& e:x)
using namespace std;
typedef long long ll;

string S;

int main(){
    cin>>S;

    if(S=="ARC"){
        cout<<"ABC"<<endl;
    }else{
        cout<<"ARC"<<endl;
    }
}

Measured memory_bytes: 3604
#include <functional>
#include <algorithm>
#include <cassert>
#include <vector>
#include <queue>
#include <iostream>
using namespace std;

int calc_g(int i, vector<int> &g, vector<int> *adj) {
    vector<int> gs;
    for (int j : adj[i]) {
        if (g[j] >= 0) gs.push_back(g[j]);
    }
    sort(gs.begin(), gs.end());
    if (gs.empty() || gs[0] > 0)
        return 0;
    else {
        for (int i = 0; i < gs.size() - 1; i++) {
            if (gs[i] + 1 < gs[i+1]) {
                return gs[i] + 1;
            }
        }
        return gs.back() + 1;
    }
}

void dfs(int i, vector<int> &g, vector<int> *adj, vector<bool> &visited) {
    visited[i] = true;
    bool ok = true;
    for (int j : adj[i]) {
        if (!visited[j]) dfs(j, g, adj, visited);
        if (ok && g[j] == -1) ok = false;
    }
    if (ok) {
        g[i] = calc_g(i, g, adj);
    }
}

int main() {
    int n; cin >> n;
    vector<int> adj[n];
    int p[n];
    for (int i = 0; i < n; i++) {
        cin >> p[i], p[i]--;
        adj[p[i]].push_back(i);
    }
    vector<int> g(n, -1);
    vector<bool> visited(n, false);

    for (int i = 0; i < n; i++) if (!visited[i]) dfs(i, g, adj, visited);
    vector<int> cycle;
    for (int i = 0; i < n; i++) {
        if (g[i] == -1) {
            for (int j = i;;) {
                for (int k : adj[j]) {
                    if (g[k] == -1) {
                        cycle.push_back(k);
                        j = k;
                        break;
                    }
                }
                if (j == i) break;
            }
            break;
        }
    }
    const int x = calc_g(cycle.back(), g, adj);

    g[cycle.back()] = x;
    for (int i = cycle.size() - 2; i >= 0; i--)
        g[cycle[i]] = calc_g(cycle[i], g, adj);
    if (x == calc_g(cycle.back(), g, adj)) {
        cout << "POSSIBLE\n";
        return 0;
    }

    g[cycle.front()] = x;
    for (int i = cycle.size() - 1; i > 0; i--)
        g[cycle[i]] = calc_g(cycle[i], g, adj);
    if (x == calc_g(cycle.front(), g, adj)) {
        cout << "POSSIBLE\n";
        return 0;
    }

    cout << "IMPOSSIBLE\n";
}


Measured memory_bytes: 28344
fun main() {
    val k = readInt()
    val (a, b) = readIntList()
    if ((a..b).count { it % k == 0 } > 0) {
        println("OK")
    } else {
        println("NG")
    }
}

fun readString() = readLine()!!
fun readInt() = readLine()!!.toInt()
fun readLong() = readLine()!!.toLong()
fun readIntList() = readLine()!!.split(" ").map(String::toInt)
fun readLongList() = readLine()!!.split(" ").map(String::toLong)
fun <T> Array<Array<T>>.print() {
    this.forEach {
        println(it.joinToString(" "))
    }
}

Measured memory_bytes: 36552
n, m = list(map(int, input().split()))
#n, m = list(map(int, input().split()))
x = list(map(int, input().split()))
# abc = [int(input()) for i in range(5)]
# n = int(input())
# n, m = list(map(int, input().split()))
if n >= m:
    print(0)
else:
    x.sort()
    ans = x[-1]-x[0]
    p = []
    for i in range(m-1):
        p.append(x[i+1]-x[i])
    p.sort(reverse=True)
    for i in range(n-1):
        ans -= p[i]
    print(ans)


Measured memory_bytes: 13960
#include <iostream>
typedef long long ll;


using namespace std;
#define MOD 1000000007;

int main() {

    int N; cin >> N;
    int K; cin >> K;
    ll a[200000+1] = {0};
    // int ans[200000+1] = {0};
    // for(int i = 0; i < N; i++){
    //     cin >> a[i];
    // }
    for(int i = 1; i <= N; i++){
        a[i] = i + a[i-1];
    }

    ll ans = 0;
    for(int i = K; i <= N; i++){
        int index = i-1;
        ll min = a[index];
        ll max = a[N]-a[N-i];
        // cout << max - min + 1 << endl;
        ll tmp = (max - min + 1) % MOD;
        // cout << tmp << endl;
        ans += tmp;
        ans %= MOD;
        // cout << ans << endl;
    }

    cout << ans+1 << endl;
    
    
}

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

int main(){
  string s; cin >> s;
  if(s.length() < 4){cout << "No" << endl; return 0;}
  if(s.substr(0,4) == "YAKI"){
    cout << "Yes" << endl;
  }
  else{
    cout << "No" << endl;
  }
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn=3e3+10;
int dp1[maxn][maxn],dp2[maxn][maxn];
int w[maxn],v[maxn];
int main(){
    int n,t;
    scanf("%d%d",&n,&t);
    for(int i=1;i<=n;i++)scanf("%d%d",&w[i],&v[i]);
    for(int i=1;i<=n;i++){
        for(int j=t;j>=0;j--)
            if(j>=w[i])
            dp1[i][j]=max(dp1[i-1][j],dp1[i-1][j-w[i]]+v[i]);
            else dp1[i][j]=dp1[i-1][j];
    }
    for(int i=n;i>=1;i--){
        for(int j=t;j>=0;j--){
            if(j>=w[i])
            dp2[i][j]=max(dp2[i+1][j],dp2[i+1][j-w[i]]+v[i]);
            else dp2[i][j]=dp2[i+1][j];
        }
    }
    int maxx=0;
    for(int i=1;i<=n;i++)
        for(int j=0;j<t;j++)
            maxx=max(maxx,dp1[i-1][j]+dp2[i+1][t-1-j]+v[i]);
    printf("%d\n",maxx);
    return 0;
}


Measured memory_bytes: 70912
import java.util.Scanner;
public class Main {
    public static void main(String[] args) throws Exception {
       Scanner sc = new Scanner(System.in);
 
        int A = sc.nextInt();
        int B = sc.nextInt();
        int C = sc.nextInt();
        int D = sc.nextInt();
        for(;;){
            if(C <= B){
                System.out.println("Yes");
                break;
            }
            C = C - B;
          
            if(A <= D){
                 System.out.println("No");
                break;
            }
            A = A - D;
        }
    }
}

Measured memory_bytes: 35716
#include<stdio.h>
#define MAX 100000
#define NIL -1
struct node{
  int p;
  int l;
  int r;
};
struct node T[MAX];
int D[MAX];

void rec(int u,int p){
  D[u]=p;
  if(T[u].r!=NIL) rec(T[u].r,p);
  if(T[u].l!=NIL) rec(T[u].l,p+1);
}
void print(int u){
  int i,c;
  printf("node %d: parent = %d, depth = %d, ",u,T[u].p,D[u]);
  if(T[u].p==NIL) printf("root, ");
  else if(T[u].l==NIL) printf("leaf, ");
  else printf("internal node, ");

  printf("[");
  for(i=0,c=T[u].l;c!=NIL;i++,c=T[c].r){
    if(i) printf(", ");
    printf("%d",c);
  }
  printf("]\n");
}
int main(){

  int n,i,j,u,v,d,a,r,l;

  scanf("%d",&n);
  for(i=0;i<n;i++) T[i].p=T[i].l=T[i].r=NIL;

  for(i=0;i<n;i++){
    scanf("%d %d",&u,&v);
    for(j=0;j<v;j++){
      scanf("%d",&a);
      if(j==0) T[u].l=a;
      else T[l].r=a;
      l=a;
      T[a].p=u;
    }
  }
  for(i=0;i<n;i++){
    if(T[i].p==NIL) r=i;
  }

  rec(r,0);

  for(i=0;i<n;i++) print(i);

  return 0;
}



Measured memory_bytes: 6484
object Main extends App{
  val Array(n,k) = scala.io.StdIn.readLine.split(" ").map(_.toInt)
  val inputs = for(count <- 1 to 2*k) yield scala.io.StdIn.readLine
  val As = (2 to 2*k by 2).map(e => inputs(e-1)).map(e1 => e1.split(" ").map(_.toInt).toList).reduce(_ ::: _)
  val nothave = (1 to n).toSet.diff(As.distinct.toSet)
  println(nothave.toSeq.size)
}


Measured memory_bytes: 57812
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (ll i = 0; i < n; i++)
#define rep1(i, n) for (ll i = 1; i < n; i++)
using P = pair<ll, ll>;

int main()
{
    ll n, a, b;
    cin >> n >> a >> b;
    cout << min(n * a, b) << endl;
    return 0;
}

Measured memory_bytes: 3624
#include<bits/stdc++.h>
using namespace std;
int main(){
long long a,b,c;
cin>>a>>b>>c;
if((a==b&&a!=c)||(a==c&&a!=b)||(b==c&&b!=a)){
    cout<<"Yes"<<endl;
}
else{
    cout<<"No"<<endl;
}


    return 0;

}

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

using namespace std;
#define int long long
const int MOD = 1000000007;

signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int N;
	cin >> N;
	vector<int> A(N);
	int res = 0;
	int a = 0;
	for (int i = 0; i < N; i++) {
		cin >> A[i];
		a ^= A[i];
	}
	for (int i = 0; i < N; i++) {
		if (i > 0) cout << " ";
		cout << (A[i] ^ a);
	}
	cout << endl;
}

Measured memory_bytes: 4776
def main():
    n=int(input())
    a=[]
    for _ in range(n):
        a.append(list(map(int,input().split())))
    dp=[]
    dp.append([a[0][0],a[0][1],a[0][2]])
    for i in range(1,n):
        tmpa=max(dp[i-1][1],dp[i-1][2])+a[i][0]
        tmpb=max(dp[i-1][0],dp[i-1][2])+a[i][1]
        tmpc=max(dp[i-1][0],dp[i-1][1])+a[i][2]
        dp.append([tmpa,tmpb,tmpc])
    print(max(dp[n-1]))
if __name__=='__main__':
    main()


Measured memory_bytes: 69848
// #include <bits/stdc++.h>
#include <iostream>
#include <vector>
#define rep(i,s,n) for (int i=s;i<n;++i)
#define drep(i,s,n) for (int i=n;i>=s;--i)
#define all(x) (x).begin(),(x).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define print(x) cout<<(x)<<endl
using namespace std;
typedef long long ll;

int gcd(int a,int b)
{if (a%b == 0) return(b);
 else          return(gcd(b,a%b));}
int lcm(int a,int b)
{return a*b/gcd(a,b);}
void printv(vector<auto> v) {cout<<'[';rep(i,0,v.size()){cout<<v[i]<<',';}cout<<']'<<endl;}
void printvv(vector<vector<auto>> vv)
{
  cout<<'['<<endl;
  rep(q,0,vv.size()){cout<<'[';rep(p,0,vv.at(q).size())cout<<vv.at(q).at(p)<<',';cout <<']'<<endl;}
  cout<<']'<<endl;
}
void solve(); int main(){cin.tie(0);ios::sync_with_stdio(0);solve();}
int step_x[] = {-1,0,0,1};
int step_y[] = {0,-1,1,0};
//------------------------------------------------------------
ll a,b,c,d,ans=0;

void solve() {
  cin>>a>>b>>c>>d;

  while (true)
  {
    c=c-b;
    if(c<=0){print("Yes");break;}
    a=a-d;
    if(a<=0){print("No");break;}
  }

  return;
}


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

using namespace std ;

#define sz(v) (int)v.size()
#define ll long long
#define all(v)  v.begin() , v.end()
#define rall(v)  v.rbegin() , v.rend()
#define pf push_front
#define pb push_back
#define fast FastInputOutput() ;
#define Clear( container , value ) memset( container , value , sizeof container )
#define PI acos( -1.0 )
#define forn( t , v , be , n ) for( t v = be ; v < n ; v++ )
#define fore( x , j ) for( auto x : j )
#define se second
#define fr first
//#define c_b fflush(stdin);

const ll Long_max = numeric_limits < ll > :: max() ;
const int Int_max = numeric_limits < int > :: max() ;

void File_input( string pathIn ) {
    freopen( pathIn.c_str(), "r", stdin ) ;
}

void File_output( string pathOut ) {
    freopen( pathOut.c_str(), "w", stdout ) ;
}

int msg() {
    srand( time( 0 ) ) ;
    vector < string > st = {
        "Wish everyone high ratings!",
        "Good luck!",
        "Have fun!",
        "Please, read all the problems!",
        "Go Go fight!"
    } ;
    cerr << st[ rand() % sz( st ) ] ;
    return 0 ;
}

void FastInputOutput() {
    ios_base :: sync_with_stdio( 0 ) ;
    cin.tie( 0 ) ;
    cout.tie( 0 ) ;
}


int n ;

int main() {
    cin >> n ;
    cout << ( n * 800 - ( n / 15 ) * 200 ) ;
    return 0 ;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define INF 1e18
#define int long long
#define Rep(i, a, n) for (int i = (a); i < (n); i++)
#define Repr(i, n, a) for (int i = (n); i >= (a); i--)
#define rep(i, n) Rep(i, 0, n)
#define repr(i, n) Repr(i, n, 0)
#define all(a) (a).begin(), (a).end()
using namespace std;
typedef pair<int, int> P;
typedef pair<int, P> PP;
const int mod = 1000000007;

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

    int n;
    while (1)
    {
        cin >> n;
        if (n == 0)
            break;
        vector<int> a(n);
        rep(i, n) cin >> a[i];
        int sum = 0;
        rep(i, n) sum += a[i];
        int ans = 0;
        rep(i, n) if (a[i] * n <= sum) ans++;
        cout << ans << endl;
    }
}


Measured memory_bytes: 3216
#include <stdio.h>
long long solve(long long, long long);
long long pow2(long long);
long long a[5] = {0, 1, 2, 3, 3};
int main()
{
  long long n, x;
  scanf("%lld%lld", &n, &x);
    long long ans;
  ans = solve(n, x);
  printf("%lld\n",ans);
  return 0;
}
long long solve(long long n, long long x)
{
  if (n==1)
  {
    return a[x-1];
  }
  long long st = pow2(n+1) - 1, ans;//每行面包 肉饼个数和 的一半 包括中间的
  if (n>1)
  {
    if (x > st){
      // printf("st = %lld\n", st);
      // printf("n-1 = %lld x-st = %lld solve(n-1, x-st) = %lld\n", n-1, x-st, solve(n-1, x-st-1));
      // printf("pow2(n) = %lld\n", pow2(n));
      if (x-st < pow2(n+1)-2)
        ans = pow2(n)-1 + 1 + solve(n-1, x-st);//2 13
      else
        ans = pow2(n)-1 + 1 + solve(n-1, x-st-1);//2 13
      // printf("ans = %lld\n", ans);
    }
    else if(x == st)
      ans = pow2(n);
    else{
      ans = solve(n-1, x-1);
    }
  }
  return ans;
}
long long pow2(long long n)
{
  long long x = 1;
  for (int i = 0; i < n; ++i)
    x *= 2;
  return x;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
int main(){
	int a,b,c,d,e,k=0;
	cin>>a>>b>>c>>d>>e;
	while(a<0){
		k+=c;
		a+=1;
	}
	if(a==0){
		k+=d;
	}
	while(a<b){
		k+=e;
		a+=1;
	}
	cout<<k<<endl;
}
	
	
	
	
	



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

int main() {
  int N;
  string color;
  cin >> N;
  
  int p=0,w=0,g=0,y=0;
  for(int i=0; i<N ; i++){
    cin >> color;
    if(color == "P"){
      p=1;
    }else if(color == "W"){
      w=1;
    }else if(color == "G"){
      g=1;
    }else if(color == "Y"){
      y=1;
    }
  }
  
  if(p*w*g*y == 1){
    cout << "Four" << endl;
  }else if(p*w*g*y == 0){
    cout << "Three" << endl;
  }
  

}


Measured memory_bytes: 256
# 146a https://atcoder.jp/contests/abc146/tasks/abc146_a

# 入力
S = input()
# 処理
if S == 'SUN':
    answer = 7
elif S == 'MON':
    answer = 6
elif S == 'TUE':
    answer = 5
elif S == 'WED':
    answer = 4
elif S == 'THU':
    answer = 3
elif S == 'FRI':
    answer = 2
elif S == 'SAT':
    answer = 1
else:
    answer = '入力エラー'
# 出力
print(answer)

Measured memory_bytes: 9028
#include <bits/stdc++.h>
#define pb push_back
#define pi pair<int, int>
#define l first
#define r second
#define all(x) x.begin(), x.end()

const int maxn = 5e5 + 1;

using namespace std;

int n;
string s;

signed main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    string s; cin >> s;
    int n = s.size();
    bitset<26> bt;
    if (n < 26) {
        for (int i = 0; i < n; i++)
            bt[s[i] - 'a'] = 1;
        cout << s;
        for (int x = 0; x < 26; x++)
            if (!bt[x]) {
                cout << (char)(x + 'a');
                break;
            }
        return 0;
    }
    for (int i = n - 1; i >= 0; i--) {
        bool fg = 0;
        for (char j = s[i] + 1; j <= 'z'; j++) {
            fg = 1;
            for (int l = 0; l < i; l++) {
                if (s[l] == j) {
                    fg = 0;
                    break;
                }
            }
            if (!fg) continue;
            s[i] = j;
            cout << s.substr(0, i + 1);
            return 0;
        }
    }
    cout << -1;
    return 0;
}


Measured memory_bytes: 3636
package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
	"strconv"
)

func main() {
	var n, d, ans int
	fmt.Scan(&n, &d)

	xS := make([][]float64, n)

	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)

	for i := range xS {
		xS[i] = make([]float64, d)
		for j := range xS[i] {
			sc.Scan()
			tmp, _ := strconv.Atoi(sc.Text())
			xS[i][j] = float64(tmp)
		}
	}

	for i := 0; i < n; i++ {
		for j := i + 1; j < n; j++ {
			var sum float64
			for k := 0; k < d; k++ {
				sum += (xS[i][k] - xS[j][k]) * (xS[i][k] - xS[j][k])
			}
			res := math.Sqrt(sum)
			if res == float64(int64(res)) {
				ans++
			}
		}
	}
	fmt.Println(ans)
}


Measured memory_bytes: 640
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<cmath>
#include<iomanip>
using namespace std;
typedef long long ll;
const int INF=100000000;
const int MOD=1000000007;

int main()
{
  ll n, y;
  cin >> n >> y;
  bool f=false;
  for(int i=0;i<n+1;i++){
      for(int j=0;j<n-i+1;j++){
       if(i*1+j*5+(n-i-j)*10==(y/1000)){
         cout << n-i-j << " " << j << " " <<  i;
         f=true;
         break;
      	}
       }
     if(f==true) break;
  }
 if(f==false) cout<< -1 << " " << -1 << " " << -1;
  return 0;
}

Measured memory_bytes: 256
from collections import defaultdict
import sys

def main():
    input = sys.stdin.readline
    n=int(input())
    dic=defaultdict(int)
    st=set([])
    for i in range(n):
        s=input().strip('\n')
        st.add(s)
        dic[s]+=1
    maxv=max(dic.values())
    l=sorted(st)
    for i in range(len(l)):
        if dic[l[i]]==maxv:
            print(l[i])
        
    

if __name__ == '__main__':
    main()


Measured memory_bytes: 40732
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <random>
#include <bitset>
#include <queue>
#include <cmath>
#include <stack>
#include <set>
#include <map>
#define rep(i,n) for (int i=0; i<n;++i)
#define rep_down(i,n) for (int i=n-1; i>=0;--i)
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
typedef long long ll;
using namespace std;
const ll MOD = 1000000007LL;
string S;

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

  cin >> S;

  int f_a = 0;
  int f_b = 0;
  int f_c = 0;

  rep(i, S.size()){
    if (S[i] == 'a')f_a++;
    if (S[i] == 'b')f_b++;
    if (S[i] == 'c')f_c++;
  }
  bool flag = false;
  if (f_a == 1 && f_b == 1 && f_c == 1) flag = true;
  string ans = flag?"Yes":"No";
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
while line = gets do
  m,f,r = line.chomp.split(" ").map{|x| x.to_i}
  if m==-1 && f==-1 && r==-1
    break
  end
  if m==-1 || f==-1
    print "F\n"
  elsif m+f >= 80
    print "A\n"
  elsif m+f >= 65
    print "B\n"
  elsif m+f >= 50
    print "C\n"
  elsif m+f >= 30
    if r >= 50
      print "C\n"
    else
      print "D\n"
    end
  else
    print "F\n"
  end
end


Measured memory_bytes: 6876
#include <iostream>
#include <string>
#include <vector>
#include <numeric>
#include <queue>
#include <unordered_map>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <sstream>
#include <stack>
#include <map>
#include <set>

#define STARTUP {(cin.tie(0));\
 (ios::sync_with_stdio(false));}

#define REP(i,a) for(int i = 0;i < (a);++i)
#define FOR(i,a,b) for(int i = (a);i < (b); ++i)
#define ALL(obj) (obj).begin(),(obj).end()
#define SIZE(obj) (int)(obj).size()
#define MAX(list) std::max(list)
#define MIN(list) std::min(list)
#define YESNO(cond,yes,no){cout <<((cond)?(yes):(no))<<endl; }
#define SORT(list) sort(ALL((list)));
#define RSORT(list) sort((list).rbegin(),(list).rend())
#define CINVEC(vec) REP(i,(vec).size()) cin>>(vec)[i];

template<typename T>
T round_up(const T& a, const T& b) {
    return (a + (b - 1)) / b;
}

template <typename T1, typename T2>
std::istream& operator>>(std::istream& is, std::pair<T1, T2>& p) {
    is >> p.first >> p.second;
    return is;
}

template <typename T1, typename T2>
std::ostream& operator<<(std::ostream& os, std::pair<T1, T2>& p) {
    os << p.first << p.second;
    return os;
}

using ll = long long;
using namespace std;
ll mod = 1'000'000'007;

const int INF = 1'050'000'000;

int main() {
    STARTUP;

    int N;
    cin >> N;
    int x = N * 800;
    int y = (N / 15) * 200;
    cout << x - y << endl;
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <algorithm>
using namespace std;
int val, size_, heap[2097168]; char c[9];
inline void insert(int x) {
	int ptr = size_++; heap[ptr] = x;
	while (ptr > 1) {
		if (heap[ptr >> 1] < heap[ptr]) swap(heap[ptr], heap[ptr >> 1]);
		ptr >>= 1;
	}
}
inline int extract() {
	int ret = heap[1], ptr = 1;
	while ((ptr << 1) + 1 < size_) {
		ptr <<= 1;
		if (heap[ptr] > heap[ptr + 1]) swap(heap[ptr >> 1], heap[ptr]);
		else swap(heap[ptr + 1], heap[ptr >> 1]), ptr++;
	}
	heap[ptr] = heap[--size_], heap[size_] = 0;
	while (ptr > 1) {
		if (heap[ptr >> 1] < heap[ptr]) swap(heap[ptr], heap[ptr >> 1]);
		ptr >>= 1;
	}
	return ret;
}
int main() {
	size_ = 1;
	while (scanf("%s", c), c[2] != 'd') {
		if (c[0] == 'i') scanf("%d", &val), insert(val);
		else printf("%d\n", extract());
	}
	return 0;
}

Measured memory_bytes: 6488
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define repp(i,m,n) for(int (i)=(m);(i)<(n);(i)++)
#define repm(i,n) for(int (i)=(n-1);(i)>=0;(i)--)
#define INF (1ll<<60)
#define all(x) (x).begin(),(x).end()
typedef long long lint;
const lint MOD =1000000007;
const lint MAX = 10000000;
using Graph =vector<vector<lint>>;
typedef pair<lint,lint> P;

 
lint fac[MAX], finv[MAX], inv[MAX];

void COMinit() // 二項係数を求める時は前処理としてCOMinit()をする
{
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (lint i = 2; i < MAX; i++)
    {
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}
 
// 二項係数計算
long long COM(lint n, lint k)
{
    if (n < k)
        return 0;
    if (n < 0 || k < 0)
        return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

lint primary(lint num)
{
    if (num < 2) return 0;
    else if (num == 2) return 1;
    else if (num % 2 == 0) return 0; // 偶数はあらかじめ除く

    double sqrtNum = sqrt(num);
    for (int i = 3; i <= sqrtNum; i += 2)
    {
        if (num % i == 0)
        {
            // 素数ではない
            return 0;
        }
    }

    // 素数である
    return 1;
}
lint lcm(lint a,lint b){
      return a/__gcd(a,b)*b;
  }
 
  int main(){
      lint A,B;
      string s,t,u;
      cin>>s>>t>>A>>B>>u;
      if(s==u)A--;
      if(t==u)B--;
      cout<<A<<" "<<B;

      
  }
  

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <iostream>
#include <algorithm>
#include <ctype.h>
#include <math.h>
#include <stack>
#include <string>
#include <string.h>
using namespace std;
double PI = 3.1415926535897932;
long mod = 1000000007;

const long INF = 1e9 + 1;

int main() {
  int k,x;
  cin >> k >> x;
  for(int i = x-k+1; i < x+k; i++) {
    if(i == x+k-1) cout << i << endl;
    else cout << i << " ";
  }
}

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

int main()
{
    long long s;
    cin >> s;
    set<long long> st;
    long long a = s;
    int cnt = 1;
    while (st.count(a) == 0)
    {
        st.insert(a);
        cnt++;
        if (a % 2 == 0)
            a /= 2;
        else
            a = 3 * a + 1;
    }
    cout << cnt << endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.*;
import java.util.Collections;
import java.util.ArrayList;

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

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

        loop:for(int i=0; i<=N; i++){
            for(int j=0; j<=N-i; j++){
                for(int k=0; k<=N-i-j; k++){
                    if(10000*i+5000*j+1000*k>Y){
                        break;
                    }
                    else{
                        if(10000*i+5000*j+1000*k==Y && i+j+k==N){
                            System.out.println(i + " " + j + " " + k);
                            break loop;
                        }
                    }
                }
            }
            if(i==N){
                System.out.println(-1 + " " + -1 + " " + -1);
            }
        }
    } 
}

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

int main() {
    #ifdef DEBUG
        freopen("in.txt", "r", stdin);
    #endif
    ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);

    int k; string s; cin >> k >> s;
    if (s.size() > k) {
        for (int i = 0; i < k; i++) {
            cout << s[i];
        }
        cout << "...\n";
    } else {
        cout << s << '\n';
    }

    return 0;
}


Measured memory_bytes: 3616
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cassert>
#include <algorithm>
typedef long long lint;
const int N=305;
int n,cnt,dis[N][N],mp[N][N];
struct _pair{
	int x,y;
	friend bool operator < (const _pair &a,const _pair &b){
		return dis[a.x][a.y]<dis[b.x][b.y];
	}
}pr[N*N];


namespace utils{
	template <class T> inline void apn(T &x,const T y){x=x<y?x:y;}
	template <class T> inline void apx(T &x,const T y){x=x<y?y:x;}
	inline int nxi(){
		int x=0;
		char c;
		while(((c=getchar())>'9'||c<'0')&&c!='-');
		const bool f=(c=='-')&&(c=getchar());
		while(x=x*10-48+c,(c=getchar())>='0'&&c<='9');
		return f?-x:x;
	}
}
using namespace utils;

namespace U{
	int fa[N];
	int find_rt(const int x){
		return fa[x]?fa[x]=find_rt(fa[x]):x;
	}
}

int main(){
#ifdef LOCAL
	freopen("road.in","r",stdin);
	freopen("road.out","w",stdout);
#endif
	n=nxi();
	for(int i=1; i<=n; ++i){
		for(int j=1; j<=n; ++j){
			dis[i][j]=nxi();
		}
	}
	for(int i=1; i<=n; ++i){
		for(int j=1; j<=n; ++j){
			for(int k=1; k<=n; ++k){
				if(dis[i][j]+dis[j][k]<dis[i][k]){
					puts("-1");
					return 0;
				}
			}
		}
	}
	for(int i=1; i<=n; ++i){
		for(int j=i+1; j<=n; ++j){
			pr[++cnt]=(_pair){i,j};
		}
	}
	std::sort(pr+1,pr+cnt+1);
	memset(mp,63,sizeof(mp));
	for(int i=1; i<=n; ++i){
		mp[i][i]=0;
	}
	lint ans=0;
	for(int i=1; i<=cnt; ++i){
		int x=pr[i].x,y=pr[i].y;
		if(mp[x][y]==dis[x][y]) continue;
		mp[x][y]=mp[y][x]=dis[x][y];
		for(int j=1; j<=n; ++j){
			apn(mp[j][y],mp[j][x]+dis[x][y]);
			mp[y][j]=mp[j][y];
		}
		for(int j=1; j<=n; ++j){
			apn(mp[j][x],mp[j][y]+dis[y][x]);
			mp[x][j]=mp[j][x];
		}
		for(int j=1; j<=n; ++j){
			for(int k=1; k<=n; ++k){
				apn(mp[j][k],mp[j][x]+mp[x][k]);
			}
		}
		ans+=dis[x][y];
	}
	printf("%lld\n",ans);
	return 0;
}


Measured memory_bytes: 1280
#include <stdio.h>
#include <math.h>


int main(){

char m[4];

scanf("%s", m);


int x=0;

if(m[0]==m[1] ||m[2]==m[3] ||m[1]==m[2]  ){

x=1;

}


if(x==0){


printf("Good");

}else{

printf("Bad");

}


return 0;

}

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

int main(){
    int K, X;
    // int N;
    // vector<int>     vA(100010, 0);
    // map<int64_t, int>   mP;
    // int res;

    cin >> K >> X;
    // for (int i=0; i<N; i++){
    //     int Ai;
    //     cin >> Ai;
    //     vA.at(Ai)++;
    //     AiMax = max(AiMax, Ai);
    // }

    for (int i=X-K+1; i<X+K; i++){
        cout << i << " ";
    }

    cout << endl;
    return 0;
}


Measured memory_bytes: 256
'''
自宅用PCでの解答
'''
import math
#import numpy as np
import itertools
import queue
import bisect
from collections import deque,defaultdict
import heapq as hpq
from sys import stdin,setrecursionlimit
#from scipy.sparse.csgraph import dijkstra
#from scipy.sparse import csr_matrix
ipt = stdin.readline
setrecursionlimit(10**7)
mod = 10**9+7

def main():
    n,k = map(int,ipt().split())
    s = input()
    nms = []
    if s[0] == "0":
        nms.append(0)
        ps = "0"
    else:
        ps = "1"
    st = 1
    for i in s[1::]:
        if i == ps:
            st += 1
        else:
            nms.append(st)
            st = 1
            ps = i
    nms.append(st)
    if s[-1] == "0":
        nms.append(0)
#    print(nms)
    ln = len(nms)
    sm = sum(nms[:min(2*k+1,ln):])
    ma = sm
    for i in range(2*k+2,ln,2):
        sm += nms[i]+nms[i-1]-nms[i-2*k-2]-nms[i-2*k-1]
        if ma < sm:
            ma = sm
    print(ma)

    return None

if __name__ == '__main__':
    main()


Measured memory_bytes: 81832
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ

		Scanner sc=new Scanner(System.in);
		
		int n=sc.nextInt();
		int d=sc.nextInt();
		int ans=(n+d*2)/(d*2+1); //最小値出す
		
		System.out.println(ans);
	}

}


Measured memory_bytes: 27052
#include <iostream>
#include <cstdio>
#include <queue>
#include <cstring>
#include <vector>
#include <map>
#include <algorithm>
#include <cctype>
#include <cmath>
#include <bitset>
#include <set>
#include <tuple>
using namespace std;

#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define FOR(i,k,n) for(int i=(k);i<(int)(n);++i)
#define all(i,n) (i),(i+n)

int dx4[4]={1,0,-1,0};
int dy4[4]={0,-1,0,1};
int dx8[8]={1,0,-1,1,-1,1,0,-1};
int dy8[8]={1,1,1,0,0,-1,-1,-1};

typedef pair<int, int> P;
typedef pair<string, int> SP;
typedef long long ll;

const int INF = 1e9;
const ll LLINF = 1e18;
const int MAX_V = 1e6+1;
const ll mod = 1000000007;

// --------------------------------------
int n, a, b;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin >> n >> a >> b;

  int ans;
  ans = min(a * n, b);

  cout << ans << endl;
}


Measured memory_bytes: 256
// Problem : A - Frog 1
// Contest : AtCoder - Educational DP Contest
// URL : https://atcoder.jp/contests/dp/tasks/dp_a
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

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

#define int long long
#define all(x) x.begin(), x.end()
#define rev(x) x.rbegin(), x.rend()
#define rep(i,a,b) for(int i=a;i<b;i++)
#define repr(i,a,b) for(int i=a;i>=b;i--)
#define endl '\n'
#define pi 3.141592653589793238
#define mp make_pair
#define pb push_back
#define precise cout<<fixed<<setprecision(20)
#define ff first
#define ss second
#define T int t;cin>>t;rep(mmm,0,t)
#define uniq(v) v.resize(distance(v.begin(),unique(all(v))))

typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<pair<int,int>> vii;

const int N=100001;
int mod=1000000007;
//mod=998244353;

int min(int a,int b){if(a<b) return a; else return b;}
int max(int a,int b){if(a>b) return a; else return b;}
int power(int a,int b){int res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
int gcd(int p, int q){if(p%q==0) return q; else{return gcd(q,p%q);}} 
int mul(int a,int b){return ((a%mod)*(b%mod))%mod;}
int sub(int a,int b){return (((a-b)%mod)+mod)%mod;}

void solve()
{
	int n;
	cin>>n;
	vi h(n);
	rep(i,0,n)
	cin>>h[i];
	vi dp(n,0);
	rep(i,1,n)
	{
		int m=INT_MAX;
		rep(j,i-2,i)
		{
			m=min(m,dp[j]+abs(h[j]-h[i]));
		}
		dp[i]=m;
	}
	cout<<dp[n-1];
}

signed main()
{
    ios::sync_with_stdio(0); 
    cin.tie(0);cout.tie(0);
    solve();
    return 0;
}

Measured memory_bytes: 4740
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstring>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

const int MOD = 1e9 + 7;
const int iINF = 1000000000;
const long long int llINF = 1000000000000000000;

using namespace std;
using ll = long long int;
using edge = struct {
  int to;
  int cost;
};
#define REP(i, n) for (ll i = 0; i < (n); i++)
#define FOR(i, a, b) for (ll i = (a); i < (b); i++)
#define AUTO(i, m) for (auto i = (m).begin(); i != (m).end(); ++i)
#define ALL(a) (a).begin(), (a).end()
#define MAX(vec) *std::max_element(vec.begin(), vec.end());
#define MIN(vec) *std::min_element(vec.begin(), vec.end());
#define MAXI(vec)                                                              \
  std::distance(vec.begin(), *std::max_element(vec.begin(), vec.end()));
#define MINI(vec)                                                              \
  std::distance(vec.begin(), *std::min_element(vec.begin(), vec.end()));
#define BIT(n, num) std::bitset<(n)>((num)).to_string()
#define MATMUL(a, b, c)                                                        \
  REP(i, a.size())                                                             \
  REP(j, b[0].size()) REP(k, a[0].size()) c[i][j] += a[i][k] * b[k][j];
#define CLA2(a) REP(i, a.size()) REP(j, a[0].size()) a[i][j] = 0;
#define REV(T) greater<T>()

ll pow_(ll a, ll n) {
  ll x = 1;
  while (n > 0) {
    if (n & 1)
      x = (x * a) % MOD;
    a = (a * a) % MOD;
    n >>= 1;
  }
  return x;
}

vector<ll> divisor(ll n) {
  vector<ll> ret;
  for (ll i = 1; i * i <= n; i++) {
    if (n % i == 0) {
      ret.push_back(i);
      if (i * i != n)
        ret.push_back(n / i);
    }
  }
  sort(begin(ret), end(ret));
  return (ret);
}

map<ll, int> prime_factor(ll n) {
  map<ll, int> ret;
  for (ll i = 2; i * i <= n; i++) {
    while (n % i == 0) {
      ret[i]++;
      n /= i;
    }
  }
  if (n != 1)
    ret[n] = 1;
  return ret;
}

ll factorial(int n) {
  ll ans = 1;
  for (int i = 2; i <= n; i++) {
    ans *= i;
    ans %= MOD;
  }
  return ans;
}
ll P(int n, int m) {
  ll ans = 1;
  for (int i = m + 1; i <= n; i++) {
    ans *= i;
    ans %= MOD;
  }
  return ans;
}
ll power(int n, int m) {
  if (m == 0) {
    return 1;
  } else if (m % 2 == 0) {
    ll tmp = power(n, m / 2);
    return (tmp * tmp) % MOD;
  } else {
    return (n * power(n, m - 1)) % MOD;
  }
}
ll C(int n, int m) {
  return (P(n, n - m) * power(factorial(m), MOD - 2)) % MOD;
}
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};

int main() {
  ll A, B, C, K;
  cin >> A >> B >> C >> K;
  if (K % 2 == 1)
    cout << B - A << endl;
  else
    cout << A - B << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i,n) for (int i = 0; i < (n); i++)
#define RREP(i, s, n) for (int i = s; i < (n); i++)
#define ALL(a) a.begin(), a.end()
#define RALL(a) a.rbegin(), a.rend()
using namespace std;
using ll = long long;
typedef pair<int, int> pint;
const ll MOD = 1000000007;
const ll INF = MOD * MOD;
const int inf = (1<<29);

int main() {

    ll N;
    cin >> N;
    
    vector<ll> a(3*N);
    REP(i, 3*N) cin >> a[i];

    // 左から
    vector<ll> S(2*N+1, 0);
    priority_queue<ll, vector<ll>, greater<ll>> PQ1;
    for(int i = 0; i < N; i++) {
        S[i+1] = S[i] + a[i];
        PQ1.push(a[i]);
    }
    for (int i = N; i < 2*N; i++) {
        ll mi = PQ1.top();
        if (a[i] > mi) {
            S[i+1] = S[i] - mi + a[i];
            PQ1.pop();
            PQ1.push(a[i]);
        } else {
            S[i+1] = S[i];
        }
    }
    // 右から
    vector<ll> T(2*N+1, 0);
    priority_queue<ll> PQ2;
    for(int i = 0; i < N; i++) {
        T[i+1] = T[i] + a[3*N-1 - i];
        PQ2.push(a[3*N-1 - i]);
    }
    for (int i = N; i < 2*N; i++) {
        ll ma = PQ2.top();
        if (a[3*N-1 - i] < ma) {
            T[i+1] = T[i] - ma + a[3*N-1 - i];
            PQ2.pop();
            PQ2.push(a[3*N-1 - i]);
        } else {
            T[i+1] = T[i];
        }
    }
    
    ll res = -(1LL<<60);
    for(int i = N; i <= 2*N; i++) {
        res = max(res, S[i] - T[3*N-i]);
    }

    cout << res << endl;

    return 0;
}

Measured memory_bytes: 8052
#include<bits/stdc++.h>
using namespace std;
#define int long long
const int N=1000005,M=998244353;
char s[N];
int flag[N],ans,dp[N][2][3][3];
int gethash(char s[]){
	int num=0;
	for (int i=1,j=1;s[i];i++,j*=3)
		num+=j*(s[i]-'a');
	return num;	
}
void dfs(char s[]){
	int k=gethash(s);
	if (flag[k])return;
	flag[k]=1;ans++;
	for (int i=1;s[i+1];i++)
		if (s[i]!=s[i+1]){
			int k1=s[i],k2=s[i+1];
			int p=s[i]^s[i+1]^97^98^99;
			s[i]=s[i+1]=p;
			dfs(s);
			s[i]=k1;s[i+1]=k2;
		}
}
signed main(){
	scanf("%s",s+1);
	if (strlen(s+1)<=3){
		dfs(s);
		printf("%lld\n",ans);
		return 0;
	}
	int flag1=0,flag=1,sum=s[1]-'a';
	for (int i=2;s[i];i++){
		if (s[i]!=s[i-1])flag1=1;
		if (s[i]==s[i-1])flag=0;
		sum+=s[i]-'a';sum%=3;
	}
	if (flag1==0){
		puts("1");
		return 0;
	}
	for (int i=0;i<=2;i++)dp[1][0][i][i]=1;
	int n=strlen(s+1);
	for (int i=1;i<n;i++)
		for (int j=0;j<=2;j++)
			for (int k=0;k<=2;k++)
				for (int l=0;l<=2;l++){
					(dp[i+1][k==l][(j+l)%3][l]+=dp[i][0][j][k])%=M;
					(dp[i+1][1][(j+l)%3][l]+=dp[i][1][j][k])%=M;
				}
	for (int i=0;i<=2;i++)
			(flag+=dp[n][1][sum][i])%=M;			
	printf("%d\n",flag);
}

Measured memory_bytes: 29056
import math
a, b, x = map(int,input().split())
#水筒に入る水の体積V
V = (a**2) * b
#ans = 90.0 * (1.0 - x/V)
#xがVの半分以上の場合
if V / 2 <= x:
    f = 2*(V - x) / a ** 3
    print(math.degrees(math.atan(f)))
#xがVの半分以下の場合
else:
    f = 2*x / (b**2 * a)
    print(90 - math.degrees(math.atan(f)))

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

using namespace std;
typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9 + 7;
const ll LINF = 1e18;

int main() {

    string s; cin >> s;
    int n = s.length();

    int ans = INF;
    for (int i = 0; i < 26; ++i) {
        char t = 'a' + i;

        int l = 0;
        int mx = 0;
        for (int j = 0; j < n; ++j) {
            if (s[j] == t) {
                l = 0;
            } else {
                ++l;
            }

            mx = max(mx, l);
        }

        ans = min(ans, mx);
    }

    cout << ans << endl;
}

Measured memory_bytes: 256
import java.io.PrintWriter;
import java.lang.reflect.Array;
import java.util.*;
import java.io.*;
import java.util.function.*;
import java.util.stream.Collectors.*;
public class Main {

    public static void main(String[] args) { new Main().stream(); }
    final IO io = new IO();
    final PrintWriter out = new PrintWriter(System.out);
    final int INF = Integer.MAX_VALUE/2;
    void stream(){ solve(); out.flush(); }
    /// ********** 本体 ********** ///

    void solve() {
        int A = io.Int();
        int B = io.Int();
        String ans = A <= 8 && B <= 8 ? "Yay!" : ":(";
        out.println(ans);         
    }
    void FOR(int a, int b, Consumer<Integer>act) { for(int i = a; i < b; ++i) act.accept(i); }
    void REP(int a, Consumer<Integer>act) { FOR(0, a, act); }
}
/// ********** その他 ********** ///


/// ********** その他 ********** ///

class IO{
    private final InputStream in = System.in;
    private final byte[] buffer  = new byte[1<<12];
    private int   ptr = 0, buffLen = 0;
    private boolean hasNextByte()          {
        if(ptr < buffLen) return true;
        ptr = 0;
        try{ buffLen = in.read(buffer); } catch (IOException e){ e.printStackTrace(); }
        return buffLen > 0;
    }
    private int     readByte()             { return hasNextByte()? buffer[ptr++] : -1; }
    private boolean isPrintableChar(int c) { return 33 <= c && c <= 126; } //ASCII
    private void    skipUnprintable()      { while (hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++; }
    private boolean hasNext()              { skipUnprintable(); return hasNextByte();}
    private String  next()                 {
        if(!hasNext()) throw new NoSuchElementException();
        StringBuilder sb = new StringBuilder();
        int b = readByte();
        while (isPrintableChar(b)){ sb.appendCodePoint(b); b = readByte(); }
        return sb.toString();
    }
    public String String() { return next(); }
    public char   Char()   { return next().charAt(0);}
    public int    Int()    { return Integer.parseInt(next());}
    public long   Long()   { return Long.parseLong(next());}
    public double Double() { return Double.parseDouble(next());}
    public String[] StringArr (final int n) { final String[] arr = new String[n]; for(int i = 0; i < n; ++i) arr[i] = String(); return arr; }
    public char[]   CharArr   (final int n) { final char[]   arr = new char[n];   for(int i = 0; i < n; ++i) arr[i] = Char();   return arr; }
    public int[]    IntArr    (final int n) { final int[]    arr = new int[n];    for(int i = 0; i < n; ++i) arr[i] = Int();    return arr; }
    public long[]   LongArr   (final int n) { final long[]   arr = new long[n];   for(int i = 0; i < n; ++i) arr[i] = Long();   return arr; }
    public double[] DoubleArr (final int n) { final double[] arr = new double[n]; for(int i = 0; i < n; ++i) arr[i] = Double(); return arr; }
}


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

int main(){
  int N,M,C;
  cin >> N >> M >> C;
  int A[N][M],B[M];
  for(int i = 0;i < M;i++)cin >> B[i];
  for(int i = 0;i < N;i++)
    for(int j = 0;j < M;j++)cin >> A[i][j];
  int correct = 0,code;
  for(int i = 0;i < N;i++){
    code = 0;
    for(int j = 0;j < M;j++){
      code += A[i][j] * B[j];
    }
    code += C;
    if(code > 0)correct++;
  }
  cout << correct << endl;
  return 0;
}

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

int main()
{
    int A = 0, B = 0, M = 0;
    int x = 0, y = 0, c = 0;
    int min = 999999, min_A = 999999, min_B = 999999;
    int i;

    cin >> A >> B >> M;
    vector<int> refrigetor(A);
    vector<int> microwave(B);
    //冷蔵庫の読込
    for (i = 0; i < A; i++) {
        cin >> refrigetor.at(i);
        if (refrigetor.at(i) < min_A) {
            min_A = refrigetor.at(i);
        }
    }
    //電子レンジの読込
    for (i = 0; i < B; i++) {
        cin >> microwave.at(i);
        if (microwave.at(i) < min_B) {
            min_B = microwave.at(i);
        }
    }
    //割引を使わなかった場合の最安値を取得
    min = min_A + min_B;

    //割引の読込
    for (i = 0; i < M; i++) {
        cin >> x >> y >> c;
        if (refrigetor.at(x-1) + microwave.at(y-1) -c < min) {
            min = refrigetor.at(x-1) + microwave.at(y-1) - c;
        }
    }
    cout << min;
}


Measured memory_bytes: 1024
n, a, b = list(map(int, input().split()))
c = list(range(1,n + 1, 1))
d = 0

def souwa(x):
    answer = 0
    for i in range(len(str(x))):
        b = str(x)
        a = str(b[i])
        answer += int(a)
    return answer

for i in range(len(c)):
    if souwa(c[i]) >= a:
        if souwa(c[i]) <= b:
            d += c[i]
            
print(d)

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

vector<lint> enum_divisors(lint N) {
    vector<lint> res;
    for (lint i = 1; i * i <= N; ++i) {
        if (N % i == 0) {
            res.push_back(i);
            if (N/i != i) res.push_back(N/i);
        }
    }
    sort(res.begin(), res.end());
    return res;
}

signed main(){
  lint N, M; cin >> N >> M;
  vector<lint> vec = enum_divisors(M);
  lint ans;
  for(lint i = vec.size() - 1; i >= 0; i--){
    if(vec[i] * N <= M){
      ans = vec[i];
      break;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define s second
#define f first
#define next tipa_next
#define prev tipa_prev
#define ll long long

using namespace std;
const int mod = 998244353;
const int half = (mod + 1) / 2;


int N , M , K;
bool good;
int main()
{
	cin >> N >> M >> K;
	for(int i = 0; i <= N; i++)
	{
		for(int j = 0; j <= M; j++)
			if(K == M * i + j * N - 2 * i * j)
			{
				good = true;
			}
	}
	if(good)
		cout << "Yes";
	else
		cout << "No";
}



Measured memory_bytes: 256
# 0028
array = []
while True:
    try:
        a = input()
        array.append(int(a))
    except EOFError:
        break
s = set(array)
mx = max(list(map(lambda a: array.count(a), s)))
modes = list(filter(lambda a: array.count(a) == mx, sorted(s)))
print(*modes, sep = '\n')

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

int D[30][30];
int c[500][500];
int SumColorD[3][30];
int TopThC[3][3] = { {-1,-1,-1},{-1,-1,-1},{-1,-1,-1} };


int main(){
	int N, C;
	cin >> N >> C;
	for(int i=0;i<C;i++)for(int j=0;j<C;j++)cin >> D[i][j];
	for(int i=0;i<N;i++)for(int j=0;j<N;j++)cin >> c[i][j];
	
//	cout << "<get SumColorD>" << endl;
	for(int i=0;i<C;i++){
		for(int j=0;j<N;j++)for(int k=0;k<N;k++){
			SumColorD[(j+k+2)%3][i]+=D[c[j][k]-1][i];
//			cout << D[(c[j][k])-1][i] << " ";
		}
//		cout << endl;
	}
//	cout << "</get SumColorD>" << endl;

	/*
	cout << "<SumColorD>" << endl;
	for(int i=0;i<3;i++){
		cout << i << " mod 3 | ";
		for(int j=0;j<C;j++)cout << SumColorD[i][j] << " ";
		cout << endl;
	}
	cout << "</SumColorD>" << endl;
	*/	
	
	for(int color=0;color<3;color++){//for 3 colors (mod 3)
		
		for(int i=0;i<3;i++){//for top 3
			int min_num = 0;
			int min_sum = 1000000007;
			for(int j=0;j<C;j++){
				int flag = 0;
				for(int k=0;k<3;k++)if(j==TopThC[color][k]){flag++;break;}
				if(flag)continue;
				if(min_sum>SumColorD[color][j]){min_num = j; min_sum = SumColorD[color][j];}
			}
			TopThC[color][i] = min_num;
		}
	}
	
	/*
	cout << "<TopThC>" << endl;
	for(int i=0;i<3;i++){
		cout << i << " mod 3 | ";
		for(int j=0;j<3;j++)cout << "[" << TopThC[i][j] << "] ";
		cout << endl;
	}
	cout << "</TopThC>" << endl;
	*/
	
	long MIN = 500*500*1000;
	for(int i=0;i<3;i++)for(int j=0;j<3;j++)for(int k=0;k<3;k++){
		if(TopThC[0][i]==TopThC[1][j] || TopThC[0][i]==TopThC[2][k] || TopThC[1][j]==TopThC[2][k])continue;
		int sumD = SumColorD[0][TopThC[0][i]] + SumColorD[1][TopThC[1][j]] + SumColorD[2][TopThC[2][k]];
		if(MIN > sumD)MIN = sumD;
	}
	cout << MIN << endl;
	return 0;
}

Measured memory_bytes: 1280
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
Scanner sc=new Scanner(System.in);
int X=sc.nextInt();
int Y=sc.nextInt();
for(int i=0;i<=X;i++)
	{
	if(i*2+(X-i)*4==Y)
	{
		System.out.println("Yes");
		return;
	}

	}
System.out.println("No");


	}

}


Measured memory_bytes: 35752
#include<stdio.h>
int main(void)
{
	
	int n,a[10000],i,max,min;
	long long sum=0;
	scanf("%d",&n);
		for(i = 0; i < n; i++){
		scanf("%d", &a[i]);
		sum += a[i];
	}
	max = min = a[0];
		for(i = 1; i < n; i++){
		if(a[i] > max)max = a[i];
			if(a[i] < min)min = a[i];
	}
		printf("%d %d %lld\n", min, max, sum);

	return 0;
}

Measured memory_bytes: 2788
#include <bits/stdc++.h>
using namespace std;
#define repr(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define reprrev(i,a,b) for(int i=b-1;i>=a;i--) // [a, b)
#define reprev(i,n) reprrev(i,0,n)
typedef long long ll;
typedef unsigned long long ull;
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; }

const ll mod = 1e9+7;

void chmod(ll &M){
    if(M >= mod) M %= mod;
    else if(M < 0){
        M += (abs(M)/mod + 1)*mod;
        M %= mod;
    }
}

ll modpow(ll x, ll n){
    if(n==0) return 1;
    ll res=modpow(x, n/2);
    if(n%2==0) return res*res%mod;
    else return res*res%mod*x%mod;
}

ll power(ll x, ll n){
    if(n == 0) return 1;

    ll res = power(x, n/2);
    if(n%2 == 0) return res*res;
    else return res*res*x;
}

int getl(int i, int N) { return i==0? N-1:i-1; };
int getr(int i, int N) { return i==N-1? 0:i+1; };

// 線分 ab の偏角 返り値は[-π, π]
double argument(const pair<double, double> &a, const pair<double, double> &b){
    double ax=a.first, ay=a.second, bx=b.first, by=b.second;
    return atan2(by-ay, bx-ax);
}

/* <-----------------------------------------------------------------------------------> */
/* <-----------------------------------------------------------------------------------> */
/* <-----------------------------------------------------------------------------------> */
/* <-----------------------------------------------------------------------------------> */


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

    ll h; cin >> h;
    int n; cin >> n;
    ll sum = 0;
    rep(i, n) {
        ll x; cin >> x;
        sum += x;
    }

    if (sum>=h) cout << "Yes" << endl;
    else cout << "No" << endl;
    
    return 0;
}



Measured memory_bytes: 256
main::IO()
main = do
  abcc<-getLine
  let a:b:c:[] = map read (words abcc)::[Int]
  putStr ((solver a b c)++"\n")


solver::Int -> Int -> Int -> String
solver a b c = if (a+b ==c)||(b+c ==a)||(c+a ==b) then "Yes" else "No"

Measured memory_bytes: 508
#include <iostream>
#include <algorithm>
#include <vector>
#include <math.h>
#include <utility>
#include <queue>
#define INF 1000000007

using namespace std;
typedef long long int ll;

int main(){
    vector<int> dp(31,0);
    dp[0]=1;
    dp[1]=1;
    dp[2]=2;
    for (int i=3; i<31; i++) {
        dp[i] = dp[i-1]+dp[i-2]+dp[i-3];
    }
    for (;;) {
        int n;
        cin >> n;
        if(n==0) break;
        int ans = dp[n]/(10*365);
        if(dp[n]%(365*10)>0) ans++;
        cout << ans <<endl;
    }
}

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

using namespace std;

int main() {

    int n;
    cin >> n;

    vector<int> v(n);
    for(int i = 0; i < n; i++)
        cin >> v[i];

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

    cout << v[n/2] - v[n/2-1]  << endl;
    
    return 0;
}

Measured memory_bytes: 640