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

public class Main {

	public static long N;

	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);

		N = scan.nextLong();
		String S = judge(N % 26);
		N /= 26;
		int i = 1;

		while (N != 0) {
			S = judge(N % 26) + S;
			N /= 26;

		}

		System.out.println(S);
	}

	public static String judge(long x) {

		switch ((int)x) {
		case 1:
			return "a";
		case 2:
			return "b";
		case 3:
			return "c";
		case 4:
			return "d";
		case 5:
			return "e";
		case 6:
			return "f";
		case 7:
			return "g";
		case 8:
			return "h";
		case 9:
			return "i";
		case 10:
			return "j";
		case 11:
			return "k";
		case 12:
			return "l";
		case 13:
			return "m";
		case 14:
			return "n";
		case 15:
			return "o";
		case 16:
			return "p";
		case 17:
			return "q";
		case 18:
			return "r";
		case 19:
			return "s";
		case 20:
			return "t";
		case 21:
			return "u";
		case 22:
			return "v";
		case 23:
			return "w";
		case 24:
			return "x";
		case 25:
			return "y";
		case 0:
			 N -= 1;
			return "z";
		}

		return "";
	}

}

Measured memory_bytes: 39620
/*dismint|jjc*/
#include <bits/stdc++.h>
using namespace std;
#define forl(V, S, E) for(int V = S; V < E; V++)
#define ford(V, S, E) for(int V = S; V >= E; V--)
#define fore(E, X) for(auto &E:X)
#define println(X) cout << X << endl
#define printe(X) for(auto &E:X) cout << E << " "; cout << endl
typedef unordered_map<int, unordered_set<int>> graph;
typedef long long ll;

int main() {
	ios_base::sync_with_stdio(false); cin.tie(NULL);
	int n, ans = 0; cin >> n;
	forl(i, 1, n+1) {
		string s = to_string(i);
		ans += ((int)s.length())%2;
	}
	println(ans);
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define PI 3.14159265359
#define NIL (-1)
#define LL long long
using namespace std;
const int64_t MOD = 1e9 + 7;

int main() {
	int a, b;
	cin >> a >> b;

	if (a + b == 15) {
		cout << '+' << endl;
	}
	else if (a * b == 15) {
		cout << '*' << endl;
	}
	else {
		cout << 'x' << endl;
	}
}

Measured memory_bytes: 3616
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll INF = 1e18;
const ll mod = 1e9+7;
#define rep(i,n) for(int i = 0;i<n;i++)

int main(){
	int n,m,k;
	cin >> n >> m >>k;
	std::vector<ll> a(n+1,0);
	vector<ll>	asum(n+1,0);
	std::vector<ll> b(m+1,0);
	vector<ll> bsum(m+1,0);

	for(int i=1; i<n+1; i++){
		cin >> a[i];
		asum[i] = asum[i-1] + a[i];
	}
	for(int i=1;i<m+1;i++){
		cin >> b[i];
		bsum[i] = bsum[i-1] + b[i];
	}

	// // for(int i=0;i<n+1;i++)cout << a[i] <<"."<< asum[i] << endl;
	// for(int i=0;i<m+1;i++)cout << b[i] <<"," << bsum[i] <<endl;

	ll ans = 0;

	for(ll i = 0; i<n+1; i++){
		if(asum[i] > k)continue;
		else{
			int key = k-asum[i];
			auto itrator= upper_bound(bsum.begin(),bsum.end(),key);
			ll bnum = distance(bsum.begin(),itrator) -1;
			//cout << i <<","<<asum[i] << "," << bnum << endl;
			ans = max(ans , i+bnum);
		}
	}
	cout << ans << endl;


	return 0;
}

Measured memory_bytes: 9592
n=int(input())
a=list(map(int,input().split()))
c=0
for i in range(n-1):
 for j in range(0,n-i-1):
  if a[j]>a[j+1]:a[j],a[j+1]=a[j+1],a[j];c+=1
print(*a)
print(c)


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

int main()
{
  	char base;
  	cin >> base;
  	if(base == 'A')
    {
      cout << 'T' << endl;
    }
    else if(base == 'T')
    {
      cout << 'A' << endl;
    }
    else if(base == 'C')
    {
        cout << 'G' << endl;    
    }
    else
    {
      cout << 'C' << endl;
    }

	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define enld '\n'
#define rep(i,n) for(int i=0; i<(n); i++)
using namespace std;
using ll = long long;
using P = pair<int,int>;
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("Ofast")
constexpr ll INF = 1e18;
constexpr int inf = 1e9;
constexpr double INFD = 1e100;
constexpr ll mod = 1000000007;
constexpr ll mod2 = 998244353;
const double PI = 3.1415926535897932384626433832795028841971;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
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; }
// ios::sync_with_stdio(false);
// cin.tie(nullptr);
// ---------------------------------------------------------------------------

int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    string S;
    cin >> S;
    int N = S.size();
    int cnt = 0;
    for(int i=0; i<N; i++){
        if(S[i] == '(') cnt++;
        if(S[i] == ')') cnt--;
        if(S[i] == '*'){
            cout << cnt << enld;
        }
    }
    return 0;
}


Measured memory_bytes: 3240
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<n; i++)
#define int long long
#define double long double
#define mod 1000000007
#define F first
#define S second
#define P pair<long long,long long>
#define all(a) a.begin(),a.end()
#define INF 1000000000000000000
#define set(i) setprecision(i)
using namespace std;
int N,A,B,C;
vector<int> L;
int dfs(int cur, int a, int b, int c){
    if(cur==N) return (min({a,b,c})>0 ? abs(A-a)+abs(B-b)+abs(C-c)-30 : INF);
    int res0,res1,res2,res3;
    res0=dfs(cur+1, a, b, c);
    res1=dfs(cur+1, a+L.at(cur), b, c)+10;
    res2=dfs(cur+1, a, b+L.at(cur), c)+10;
    res3=dfs(cur+1, a, b, c+L.at(cur))+10;
    return min({res0,res1,res2,res3});
}
signed main(){
    cin>>N>>A>>B>>C;
    rep(i,N){
        int n; cin>>n;
        L.push_back(n);
    }
    cout<<dfs(0, 0, 0, 0)<<endl;
}

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

int main() {
	int n, m;

	vector<int> k;
	vector<vector<int>> a;
	vector<int> v;

	cin >> n >> m;

	k = vector<int>(n);
	a = vector<vector<int>>(n, vector<int>(30));

	for (int i = 0; i < n; i++) {
		int l;
		cin >> l;
		k[i] = l;
		for (int j = 0; j < l; j++)
			cin >> a[i][j];
	}
	v = vector<int>(31, 0);
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < k[i]; j++) {
			v[a[i][j]]++;
		}
	}
	int ans = 0;
	for (int i = 1; i <= 30; i++) {
		if (v[i] == n)
			ans++;
	}
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 764
#include <bits/stdc++.h>
using namespace std;
#define SPEED ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define ll unsigned long long
#define ld long double
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define eb emplace_back
const int mod = 1e9 + 7;
int main()
{
	SPEED
	string str;
	cin >> str;

	int count_str_rev = 0;
	string front = "";
	string back = "";


	int q, option;
	cin >> q;
	while(q--)
	{
		cin >> option;
		if (option == 1)
		{
			count_str_rev++;
			/*reverse(front.begin(), front.end());
			reverse(back.begin(), back.end());

			string temp = front;
			front = back;
			back = temp;*/
		}
		else if (option == 2)
		{
			int f; char ch;
			cin >> f >> ch;
			if (f==1)
			{
				if (count_str_rev&1)
				{
					back = back + ch;
				}
				else
				{
					front = ch + front;
				}
				
			}
			else if (f==2)
			{
				if (count_str_rev&1)
				{
					front = ch + front;
				}
				else
				{
					back = back + ch;
				}
				
			}
		}
	}

	if (count_str_rev&1)
	{
		reverse(str.begin(), str.end());
		reverse(front.begin(), front.end());
		reverse(back.begin(), back.end());
		string ans = back + str + front;
		cout << ans;
	}
	else
	{
		string ans = front + str + back;
		cout << ans;
	}
	return 0;
}

Measured memory_bytes: 1420
N, X = gets.split.map(&:to_i)

R = 2 * N - 1

if X == 1 || X == R
  puts 'No'
  exit
end

if N == 2
  puts 'Yes'
  puts [1, 2, 3]
  exit
end

ans = Array.new(R, -1)
used = Hash.new

ans[N - 2] = X + 1
ans[N - 1] = X
ans[N] = X - 1

used[X] = true
used[X - 1] = true
used[X + 1] = true

n = 1

R.times do |i|
  next if ans[i] != -1

  while used[n]
    n += 1
  end

  ans[i] = n
  used[n] = true
end

puts 'Yes'
puts ans


Measured memory_bytes: 17660
#include <iostream>
#include <vector>
#include <algorithm>
#define LLINF 1100000000000000000
#define REP(i,n) for(int i = 0; i < (n); i++)
#define PB push_back
#define ALL(c) c.begin(),c.end()

using namespace std;
typedef long long ll;

int main()
{
  int N, K;
  cin >> N >> K;
  vector<ll> l, r;

  r.PB(0);
  REP(i, N) {
    ll x; cin >> x;
    if (x > 0) r.PB(x);
    else if (x < 0) l.PB(-x);
    else K--;
  }
  if (K == 0) { cout << 0 << endl; return 0; }
  l.PB(0);
  reverse(ALL(l));

  ll ans = LLINF;

  if (K <= l.size() - 1) ans = min(ans, l[K]);
  for (int i = 1; i < l.size(); i++) {
    if (i >= K) break;
    if (K - i <= r.size() - 1) ans = min(ans, 2*l[i] + r[K-i]);
  }

  if (K <= r.size() - 1) ans = min(ans, r[K]);
  for (int i = 1; i < r.size(); i++) {
    if (i >= K) break;
    if (K - i <= l.size() - 1) ans = min(ans, 2*r[i] + l[K-i]);
  }

  cout << ans << endl;

  return 0;
}


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

N = int(input())
S = list(input().strip())
t = [[0, 0] for _ in range(N)]

w = 0
e = 0
for i in range(0, N):
    if i != 0 and S[i] == "E":
        e += 1
        
    if i != N - 1 and S[i] == "W":
        w += 1
        
t[0][1] = e
t[-1][0] = w

for i in range(1, N - 1):
    t[i][1] = t[i - 1][1]
    
    if S[i] == "E":
        t[i][1] -= 1
        
for i in reversed(range(1, N - 1)):
    t[i][0] = t[i + 1][0]
    
    if S[i] == "W":
        t[i][0] -= 1

ans = 10 ** 18
for v in t:
    ans = min(ans, v[0] + v[1])
    
print(ans)

Measured memory_bytes: 45644
use std::io::{self, Read, Write};
use std::str::{self, FromStr};

pub struct IO<R: Read, W: Write>(R, io::BufWriter<W>);

impl<R: Read, W: Write> IO<R, W> {
    pub fn new(reader: R, writer: W) -> Self {
        Self(reader, io::BufWriter::new(writer))
    }

    pub fn read<T: FromStr>(&mut self) -> T {
        let token = self
        .0
        .by_ref()
        .bytes()
        .map(|b| b.unwrap())
        .skip_while(|&b| (b as char).is_whitespace())
        .take_while(|&b| !(b as char).is_whitespace())
        .collect::<Vec<u8>>();

        unsafe { str::from_utf8_unchecked(token.as_slice()) }
        .parse()
        .ok()
        .expect("Can't parse it.")
    }

    pub fn vec<T: FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read()).collect()
    }

    pub fn chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }

    pub fn write<S: ToString>(&mut self, s: S) {
        self
        .1
        .write_all(s.to_string().as_bytes())
        .unwrap();
    }

    pub fn flush(&mut self) {
        self
        .1
        .flush()
        .unwrap();
    }
}


fn main() {
    let (r, w) = (io::stdin(), io::stdout());
    let mut rw = IO::new(r.lock(), w.lock());
    solve(&mut rw);
}

fn solve(rw: &mut IO<io::StdinLock, io::StdoutLock>) {
    let (A, B, C, X): (u32, u32, u32, u32) = (rw.read(), rw.read(), rw.read(), rw.read());

    let mut ans = 0;
    for a in 0..=A {
        for b in 0..=B {
            for c in 0..=C {
                if 500 * a + 100 * b + 50 * c == X {
                    ans += 1
                }
            }
        }
    }

    println!("{}", ans);
}

Measured memory_bytes: 2148
#include <iostream>
#include <map>
#include <set>
#include <cmath>
#include <algorithm>
#include <vector>
#include <bitset>
#include <queue>
#include <stack>
#include <deque>
#include <numeric>
#include <string>
#include <random>
typedef long long ll;
#define pb push_back
#define pf push_front
#define mii map <int, int>
#define mll map <ll, ll>
#define pii pair <int, int>
#define pll pair <ll, ll>
#define vi vector <int>
#define vll vector <ll>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define all(x) (x).begin(), (x).end()
#define F first
#define S second
#define sz(x) (int)x.size()


using namespace std;
const ll INFLL = 1e18;
const int MAXN = 3e5;
const ll INF = 1e9;
const ll kek=998244353;

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    ll n;
    cin>>n;
    ll ans=INFLL;
    for (ll i=1;i*i<=n;i++)
    {
        if (n%i==0)
        {
            ans=min(ans,i-1+n/i-1);
        }
    }
    cout<<ans;
}





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

int main(void){
  int task[3];
  for(int i = 0; i < 3; ++i){
    cin >> task[i];
  }

  sort(task, task + 3, greater<int>());

  cout << task[0]-task[2] << endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
using namespace std;
int main(){
  int i,j;
  int h,w;
  cin >> h >> w;
  vector<vector<char>> v(h+2,vector<char>(w+2,'.'));
  for(i=1;i<=h;i++){
    for(j=1;j<=w;j++){
      cin >> v[i][j];
    }
  }
  for(i=1;i<=h;i++){
    for(j=1;j<=w;j++){
      if(v[i][j]=='#'){
        if(v[i][j+1]!='#'&&v[i][j-1]!='#'&&v[i+1][j]!='#'&&v[i-1][j]!='#'){
          cout << "No" << "\n";
          return 0;
        }
      }
    }
  }
  cout << "Yes" << "\n";
  return 0;
}


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

struct Sieve{
    ll n;
    vector<ll> f;
    Sieve(int n=1): n(n), f(n+1){
        f[0] = f[1] = -1;
        for(ll i=2;i<=n;i++){
            if(f[i]) continue;
            f[i] = i;
            for(ll j=i*i;j<=n;j+=i){
                if(!f[j]) f[j] = i;
            }
        }
    }

    bool isPrime(ll x){return f[x]==x;}

    //素因数分解
    vector<int> factorlist(int x){
        vector<int> primelist;
        int nx=x;
        while(nx!=1){
            primelist.push_back(f[nx]);  //xの素因数が小さい順に並ぶ
            nx /= f[nx];
        }
        
        return primelist;
    }

    vector<pair<int,int>> factornum(int x){
        vector<int> fl = factorlist(x);
        if(fl.size()==0) return {};
        vector<pair<int,int>> vec(1,make_pair(fl[0],0));
        for(int p : fl){
            if(vec.back().first==p){
                vec.back().second++;
            }else{
                vec.emplace_back(p,1);
            }
        }

        return vec;
    }


};

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

int main(void){
    ll a,b;
    cin >> a >> b;
    ll gcdnum = gcd(a,b);
    ll primenum = 0;
    ll ngcd = gcdnum;

    for(int i=2;i<=sqrt(gcdnum);i++){
        if(ngcd%i==0){
            primenum++;
            while(ngcd%i==0) ngcd /= i; 
        }
    }
    if(ngcd!=1) primenum++;

    cout << primenum+1 << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
#define N 100
#define W 0
#define G 1
#define B 2

int n, A[N][N];
int color[N], d[N], f[N], tt;

//??±???????????¢?´¢
void dfs_visit(int u){
  int v;
  color[u] = G;
  d[u] = ++tt;

  for(v = 0; v < n; v++){
    if(A[u][v] == 0) continue;
    if(color[v] == W){
      dfs_visit(v);
    }
  }
  color[u] = B;
  f[u] = ++tt;
}

void dfs(){
  int u;
  for(u = 0; u < n; u++) color[u] = W;
  tt = 0;

  for(u = 0; u < n; u++){
    if(color[u] == W) dfs_visit(u);
  }
  
  for(u = 0; u < n; u++){
    printf("%d %d %d\n", u + 1, d[u], f[u]);
  }
}

int main(){
  int u, v, k, i, j;


  scanf("%d", &n);

  for(i = 0; i < n; i++){
    for(j = 0; j < n; j++){
      A[i][j] = 0;
    }
  }
  
  for(i = 0; i < n; i++){
    scanf("%d %d", &u, &k);
    for(j = 0; j < k; j++){
      scanf("%d", &v);
      A[u - 1][v - 1] = 1;
    }
  }

  dfs();

  return 0;

}

Measured memory_bytes: 636
import java.util.*;
import java.io.*;
import static java.lang.Math.*;
import static java.util.Arrays.*;
import static java.util.Collections.*;

public class Main implements Runnable
{
//    static int dx[]={-1,0,1,0};
//    static int dy[]={0,-1,0,1};
    static long mod=1000000007;
    
    public static void main(String[] args) {        
        new Thread(null, new Main(), "", 200 * 1024 * 1024).start();        
    }

    public void run() {
        Reader sc = new Reader(System.in);
        PrintWriter out=new PrintWriter(System.out);

        int k=sc.nextInt();
        int a=sc.nextInt();
        int b=sc.nextInt();        
        for (int i = a; i <= b; i++) {
			if(i%k==0)ret("OK");
		}
        out.println("NG");
     	out.flush();
    }

    static void ret(String ans) {
    	System.out.println(ans);
    	System.exit(0);
    }

    static void ret(long ans) {
    	System.out.println(ans);
    	System.exit(0);
    }
    
    static boolean validpos(int x,int y,int r, int c){
        return x<r && 0<=x && y<c && 0<=y;
    }

    static void db(Object... os){
        System.err.println(Arrays.deepToString(os));
    }
}

//class P {
//	int x,c;long s;
//	P(int  x, int c, long s) {
//	  this.x=x;
//	  this.c=c;
//	  this.s=s;
//	}
//}


class P implements Comparable<P>{
	int x,c;long s;
	P(int  x, int c, long s) {
	  this.x=x;
	  this.c=c;
	  this.s=s;
	}

    public int compareTo(P p){
        return Long.signum(s-p.s);
    }
}

class Reader
{ 
    private BufferedReader x;
    private StringTokenizer st;
    
    public Reader(InputStream in)
    {
        x = new BufferedReader(new InputStreamReader(in));
        st = null;
    }
    public String nextString()
    {
        while( st==null || !st.hasMoreTokens() )
			try {
				st = new StringTokenizer(x.readLine());
			} catch (IOException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
        return st.nextToken();
    }
    public int nextInt()
    {
        return Integer.parseInt(nextString());
    }
    public int[] nextIntArray(int size) {
        int r[] = new int[size];
        for (int i = 0; i < size; i++) {
            r[i] = this.nextInt(); 
        }
        return r;
    }
    public long[] nextLongArray(int size) {
        long r[] = new long[size];
        for (int i = 0; i < size; i++) {
            r[i] = this.nextLong(); 
        }
        return r;
    }
    public char[] getCharSet() {
        return this.nextString().toCharArray();
    }    
    public long nextLong()
    {
        return Long.parseLong(nextString());
    }
    public double nextDouble() throws IOException
    {
        return Double.parseDouble(nextString());
    }
}


Measured memory_bytes: 33008
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using Graph=vector<vector<int>>;
using pp=pair<ll,pair<ll,ll>>;
#define MAX 1000000
#define MOD 1000000007
#define INF 1000000000

int main(){
  int N;
  cin>>N;
  vector<ll> A(N);
  for(int i=0;i<N;i++){
    cin>>A[i];
  }
  ll ans=A[0]-1;
  ll a=1;
  for(int i=1;i<N;i++){
    if(A[i]>2*a){
      ans+=(A[i]-1)/(a+1);
    }else{
      if(A[i]>a+1){
        ans++;
      }
      if(A[i]==a+1){
        a=A[i];
      }
    }
  }
  cout<<ans<<endl;
}


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

typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
const ull mod = 1e9 + 7;
#define REP(i,n) for(int i=0;i<(int)n;++i)

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

template<class S, class T> ostream& operator << (ostream& os, const pair<S, T> v){
  os << "(" << v.first << ", " << v.second << ")"; return os;
}
template<class T> ostream& operator << (ostream& os, const vector<T> v){
  for(int i = 0; i < v.size(); i++){if(i > 0){os << " ";} os << v[i];} return os;
}
template<class T> ostream& operator << (ostream& os, const vector<vector<T>> v){
  for(int i = 0; i < v.size(); i++){if(i > 0){os << endl;} os << v[i];} return os;
}

const ll shift = 100000;
vector<ll> G[202020];
vector<bool> visited(202020, false);

ll le, ri, hen;

void dfs(ll now){
	if(visited[now]) return;

	visited[now] = true;
	if(now<shift) le++;
	else ri++;

	hen += G[now].size();

	REP(i, G[now].size()){
		ll next = G[now][i];
		if(!visited[next]){
			dfs(next);
		}
	}
}

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

    ll N;
    cin >> N;
    REP(i, N){
    	ll x, y;
    	cin >> x >> y;
    	x--, y--;
    	G[x].push_back(y+shift);
    	G[y+shift].push_back(x);
    }

    ll res = 0;
    REP(i, 202020){
    	le=0, ri=0, hen=0;
    	dfs(i);
    	res += (le*ri-hen/2);
    }

    cout << res << endl;
    return 0;
}

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

const double eps = 1e-8;

bool equals(double a, double b) {
  return abs(a-b) < eps;
}

int main() {
  while(1) {
    double sum[2];
    for(int i = 0; i < 2; ++i) {
      int m;
      cin >> m;
      if(!m) return 0;
      sum[i] = 0;
      double u = 0;
      while(--m) {
        double v;
        cin >> v;
        u += v;
        sum[i] += sin(M_PI * v / 180.0);
      }
      sum[i] += sin(M_PI * (360-u) / 180.0);
    }
    if(equals(sum[0], sum[1])) {
      cout << 0 << endl;
    } else if(sum[0] > sum[1]) {
      cout << 1 << endl;
    } else {
      cout << 2 << endl;
    }
  }
  return 0;
}

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

typedef long long ll;
typedef int64_t i6;

#define rep(i, n) for (ll i = 0; i < n; ++i)
#define Sort(x) sort(x.begin(), x.end())
#define Sort_rev(x) sort(x.begin(), x.end(), greater<int>())
#define ALL(v) (v).begin(), (v).end()

//π M_PI
//deg = rad*180/M_PI

int main() {
    ll n;
    cin >> n;
    ll a[n];
    std::vector<ll> v;
    int ans = 1;
    rep(i, n) {
        cin >> a[i];
        v.push_back(a[i]);
    }
    Sort(v);
    rep(i, n-1) {
        if ( v.at(i) == v.at(i+1) ) {
            ans = 0;
        }
    }
    if ( ans ) {
        cout << "YES" << endl;
    } else {
        cout << "NO" << endl;
    }
    return 0;
}


Measured memory_bytes: 3444
#include<bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 5;
char c[maxn], s[maxn];
int len;

int main()
{
    scanf("%s", c + 1); int L = strlen(c + 1);
    for(int i = 1; i <= L; ++i){
        if(c[i] == c[i - 1]) continue;
        s[++len] = c[i];
    }
    cout << len - 1;
    return 0;
}

Measured memory_bytes: 384
using System;
using System.Linq;
using System.Collections.Generic;
class Program
{
	static void Main(string[] args)
	{
		List<int> input = IO.GetIntList();
		int n = input[0];
		int k = input[1];
		List<long> h = IO.GetLongList();
		
		h.Sort();
		for(int i=0;i<k;i++){
		    if(n-1-i < 0) break;
		    h.RemoveAt(n-1-i);
		}
		Console.WriteLine(h.Sum());
	}

}

static class IO
{
    static public string GetString() { return Console.ReadLine(); }
    static public int GetInt() { return int.Parse(Console.ReadLine()); }
    static public long GetLong() { return long.Parse(Console.ReadLine()); }
    static public List<string> GetStringList() { return Console.ReadLine().Split(' ').ToList(); }
    static public List<int> GetIntList() { return Console.ReadLine().Split(' ').Select(int.Parse).ToList(); }
    static public List<long> GetLongList() { return Console.ReadLine().Split(' ').Select(long.Parse).ToList(); }
    static public List<double> GetDoubleList() { return Console.ReadLine().Split(' ').Select(double.Parse).ToList(); }
    static public void WriteStrings<T>(IEnumerable<T> values) { foreach (var o in values) { Console.Write(o + " "); } }
}

Measured memory_bytes: 35840
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <string>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
using namespace std;
typedef long long unsigned int ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

int main() {
    int a, b, t;
    cin >> a >> b >> t;
    int ans = t/a *b;
    cout << ans << endl;

}


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

int main()
{
    ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    int l, r;

    cin>>l>>r;

    if((l / 2019) != (r / 2019)){
        cout<<0<<endl;
        return 0;
    }
    l %= 2019, r %= 2019;

    int ans = 2e9;
    for(int i = l; i < r; i++){
        for(int j = l + 1; j <= r; j++){
            int temp = (i * j) % 2019;
            ans = min(ans, temp);
        }
    }

    cout<<ans % 2019<<endl;

    return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <cstring>
using namespace std;
int main(){

	char s[11],r[101][11],tmp[11];	
	cin>>s;
	int size=strlen(s);
	int N,ans=0;	
	cin>>N;
	for(int i=0;i<N;i++){
		cin>>r[i];
	}
	for(int i=0;i<100;i++){
		for(int j=0;j<11;j++){
			if(s[0]==r[i][j]){
				int c=0;
				for(int z=0;z<size;z++){
					if((j+z)>=10){
						tmp[z]=r[i][c];
						c++;
					}
					else{
						tmp[z]=r[i][j+z];
					}
				}
				tmp[size]='\0';
				if(strcmp(s,tmp)==0){
					ans++;
					break;
				}
			}
		}
	}
	
	cout<<ans<<endl;

return 0;
}

Measured memory_bytes: 1164
#include<iostream>
#include<string>
#include<string.h>
#include<stdio.h>
#include<algorithm>
using namespace std;
int a[100100];
int main()
{
	int n,k,i;
	scanf("%d%d",&n,&k);
	for (i=1;i<=n;i++)
	    scanf("%d",&a[i]);
	int ans=(n-1)/(k-1);
	if ((n-1)%(k-1)) ans++;
	printf("%d",ans);
	return 0;
}

Measured memory_bytes: 640
import java.awt.Polygon;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;


public class Main {
	private	static	BufferedReader	br = null;

	static {
		br = new BufferedReader(new InputStreamReader(System.in));
	}
 
    /**
     * @param args
     */
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		int	num = parseNum();

		for (int i = 0; i < num; i++) {
			solve(parsePos());
		}
	}

	private static void solve(int[][] pos) {
		Polygon	tri = new Polygon();

		for (int i = 0; i < 3; i++) {
			tri.addPoint(pos[i][0], pos[i][1]);
		}

		if (tri.contains(pos[3][0], pos[3][1]) != tri.contains(pos[4][0], pos[4][1])) {
			System.out.println("OK");
		} else {
			System.out.println("NG");
		}
	}

	private static int[][] parsePos() {
		int[][]	pos = null;
		String	str = null;

		if ((str = parseStdin()) != null) {
			String[]	lns = str.split(" ");

			pos = new int[5][2];
			for (int i = 0; i < pos.length; i++) {
				pos[i][0] = Integer.parseInt(lns[i*2]);
				pos[i][1] = Integer.parseInt(lns[i*2+1]);
			}
		}
 
		return pos;
	}

	private static int parseNum() {
		int		param = 0;
		String	strin = null;

		if ((strin = parseStdin()) != null) {
			param = Integer.parseInt(strin);
		}
 
		return param;
	}

	private static String parseStdin() {
        String  stdin = null;
        
        try {
        	String  tmp = br.readLine();
        	if (tmp != null) {
            	if (!tmp.isEmpty()) {
            		stdin = tmp;
            	}
        	}
        }
        catch (IOException e) {}
 
        return stdin;
	}
}

Measured memory_bytes: 45548
#include <bits/stdc++.h>
using namespace std;
using ll= long long;
using vi= vector<int>;
using vvi= vector<vi>;
using vd= vector<double>;
using vvd= vector<vd>;
using vc= vector<char>;
using vb= vector<bool>;
using vl= vector<ll>;
#define rep(i,x,n) for(int i=x; i<n; i++)
#define all(x) x.begin(), x.end()

int main(){
  int x;
  cin >> x;
  if(x<1200){
    cout << "ABC";
  }else{
    cout << "ARC";
  }
  
  return 0;
}


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

#define REP(i, x) for (int i = 0; i < (int)(x); i++)
#define ALL(x) (x).begin(), (x).end()

typedef long long ll;
using namespace std;

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

  int R;
  cin >> R;
  cout << 3 * R * R << endl;

  return 0;
}


Measured memory_bytes: 256
def t(n):
  if n%10==0:
    return n
  else:
    return ((n//10)+1)*10
def k(n):
  if n%10==0:
    return 0
  else:
    return 10-(n%10)
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
L=[k(a),k(b),k(c),k(d),k(e)]
print(t(a)+t(b)+t(c)+t(d)+t(e)-max(L))

Measured memory_bytes: 9148
import java.util.Scanner;

public class Main {

	@SuppressWarnings("resource")
	public static void main(String args[]) {
		Scanner scanner = new Scanner(System.in);
		int a = scanner.nextInt();
		int b = scanner.nextInt();
		int c = scanner.nextInt();
		int d = scanner.nextInt();
		int ans = 0;

		if (c < a && d < a) {
			ans = 0;
		}
		if (c <= a && d >= a && d <= b) {
			ans = d - a;
		}

		if (c >= a && d <= b) {
			ans = d - c;
		}
		if (c >= a && d >= b && c <= b) {
			ans = b - c;
		}

		if (b < c) {
			ans = 0;
		}
		if (c <= a && b <= d) {
			ans = b - a;
		}

		System.out.println(ans);
	}
}


Measured memory_bytes: 23252
import sys

n = int(input())
x = sorted(list(map(int, input().split())))

if len(list(set(x))) == 1:
    print(0)
    sys.exit()

if n == 1:
    print(0)
    sys.exit()

x_min = x[0]
x_max = x[n-1]
min_sum = 10000000
for p in range(x_min, x_max):

    sum = 0
    for e in x:
        len = (e - p)**2
        sum += len
    # print("p", p, "sum", sum, "min_sum", min_sum)
    if sum <= min_sum:
        min_sum = sum
print(min_sum)


Measured memory_bytes: 63744
//#include <bits/stdc++.h>
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <map>
#include <iomanip>
#include <stdlib.h>
#include <queue>
#include <deque>
#include <set>

using namespace std;

const int nmax = 1e9 + 7;
const long long INF = 1e18;
const double PI = 2 * asin(1);
typedef long long ll;

int main(){
  int N, M; cin >> N >> M;
  vector <int> graph[N];

  for (int i = 0; i < M; i++){
    int A, B; cin >> A >> B;
    A--; B--;
    graph[A].push_back(B);
    graph[B].push_back(A);
  }
  
  deque <int> dq{0, graph[0][0]};
  vector <bool> visited(N);

  visited[0] = true; visited[graph[0][0]] = true;

  while (true){
    bool flag = true;
    int now = dq.front();
    for (int i = 0; i < graph[now].size(); i++){
      int next = graph[now][i];
      if (visited[next] == false){
        visited[next] = true;
        flag = false;
        dq.push_front(next);
        break;
      }
    }
    if (flag == true) break;
  }
  
  while (true){
    bool flag = true;
    int now = dq.back();
    for (int i = 0; i < graph[now].size(); i++){
      int next = graph[now][i];
      if (visited[next] == false){
        visited[next] = true;
        flag = false;
        dq.push_back(next);
        break;
      }
    }
    if (flag == true) break;
  }
  
  cout << dq.size() << endl;
  while (!dq.empty()){
    cout << dq.front() + 1;
    dq.pop_front();

    if (dq.empty()) cout << endl;
    else cout << " ";
  }

  
  return 0;
}


Measured memory_bytes: 6656
#include<bits/stdc++.h>
    #define ll long long 
    using namespace std;
    const int MAXN=1010;
    const ll MAX=50;
    ll a[MAXN],b[MAXN*MAXN];
    bool c[MAXN*MAXN];
    int n,k,len;
    ll ans;
    int main()
    {
      scanf("%d%d",&n,&k);
      for (int i=1;i<=n;i++)
        {
          scanf("%lld",&a[i]);
        }
      for (int i=1;i<=n;i++)
        {
          ll sum=0;
          for (int j=i;j<=n;j++)
    	{
    	  sum+=a[j]; b[++len] =sum;
    	}
        }
      for (int i=1;i<=len;i++) c[i]=1;
      for (int j=MAX;j>=0;j--)
        {
          int sum=0;
      for (int i=1;i<=len;i++)
        if (c[i])
        {
          if ((b[i]>>j)&1ll) sum++;
        }
      if (sum>=k)
        {
          ans|=(1ll<<j);
          for (int i=1;i<=len;i++)
    	if  (c[i])
    	  if (!((b[i]>>j)&1ll)) c[i]=0;
        }
        }
      //for (int i=1;i<=len;i++) cout << a[i] << endl;
      //cout << len << endl;
      cout << ans << endl;
    }

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


COST = {
    1: 2,
    2: 5,
    3: 5,
    4: 4,
    5: 5,
    6: 6,
    7: 3,
    8: 7,
    9: 6,
}
A = sorted(A, reverse=True)

best = [None for _ in range(N + 1)]
best[0] = tuple([0] * len(A))
for n in range(N + 1):
    for ai, a in enumerate(A):
        before = n - COST[a]
        if before < 0 or best[before] is None:
            continue
        val = tuple(x + (1 if i == ai else 0) for i, x in enumerate(best[before]))
        if (
            best[n] is None
            or sum(best[n]) < sum(val)
            or (sum(best[n]) == sum(val) and best[n] < val)
        ):
            best[n] = val
print(''.join(sorted(''.join(str(d) * n for d, n in zip(A, best[N])), reverse=True)))

Measured memory_bytes: 46556
import sys
sys.setrecursionlimit(10**7)
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x) - 1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def II(): return int(sys.stdin.readline())
def SI(): return sys.stdin.readline().strip()
INF = 10 ** 18
MOD = 10 ** 9 + 7

# from functools import lru_cache


def main():
    N, M = LI()
    es = [[x for x in LI()] for _ in range(M)]

    from collections import defaultdict
    outs = defaultdict(list)  # ノードが int なら、[[] for _ in range(n+1)] でもよさそう。
    # ins = defaultdict(int)    # ノードが int なら、 [0 for _ in range(n+1)] でもよさそう。
    for from_v, to_v in es:
        outs[from_v].append(to_v)
        # ins[to_v] += 1

    # @lru_cache()
    memo = [None for _ in range(N+1)]
    def max_len(v):
        if memo[v] is not None:
            return memo[v]

        if not outs[v]:
            memo[v] = 0
            return 0
        else:
            memo[v] = max([max_len(x)+1 for x in outs[v]])
            return memo[v]

    print(max([max_len(x) for x in range(1,N+1)]))


main()

Measured memory_bytes: 143544
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <complex>
#include <string>
#include <sstream>
#include <algorithm>
#include <numeric>
#include <vector>
#include <queue>
#include <stack>
#include <functional>
#include <iostream>
#include <map>
#include <set>
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-9
#define INF 2000000000
#define sz(x) ((int)(x).size())
#define fi first
#define sec second
#define SORT(x) sort((x).begin(),(x).end())
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define repn(i,a,n) for(int (i)=(a);(i)<(int)(n);(i)++)
#define EQ(a,b) (abs((a)-(b))<eps)
int V,E;
vector<int> g[100100];
bool used[100100];
int col[100100];
bool flag=false;
int cnt[3];
int dp[100100];
int num[600];
map<int,int> m;
void dfs(int v,int c)
{
	used[v]=true;
	col[v] = c;
	cnt[c+1]++;
	for(int i=0;i<g[v].size();i++)
	{
		if(used[g[v][i]]&&col[g[v][i]]==col[v])flag=true;
		if(!used[g[v][i]])dfs(g[v][i],-c);
	}
}
int main()
{
	scanf("%d %d",&V,&E);
	for(int i=0;i<E;i++)
	{
		int a,b;
		scanf("%d %d",&a,&b);
		a--;b--;
		g[a].pb(b);
		g[b].pb(a);
	}
	vector<int> v;
	ll base = 0ll;
	ll sum = 0ll;
	for(int i=0;i<V;i++)
	{
		cnt[0]=0,cnt[2]=0;
		if(!used[i])
		{
			dfs(i,1);
			if(cnt[0]>cnt[2])swap(cnt[0],cnt[2]);
			base += cnt[0];
			sum += cnt[2]-cnt[0];
			v.pb(cnt[2]-cnt[0]);
			m[cnt[2]-cnt[0]]++;
		}
	}
	if(flag)
	{
		printf("-1\n");
		return 0;
	}
	sort(all(v));
	v.erase(unique(all(v)),v.end());
	int N = v.size();
	//cout << base << ' ' << sum << endl;
	for(int i=0;i<N;i++)num[i]=m[v[i]];
	//for(int i=0;i<N;i++)printf("%d %d\n",v[i],num[i]);
	memset(dp,-1,sizeof(dp));
	dp[0]=0;
	for(int i=0;i<N;i++)
	{
		for(int j=0;j<=V;j++)
		{
			if(dp[j]>=0)dp[j]=num[i];
			else if(j<v[i]||dp[j-v[i]]<=0)dp[j]=-1;
			else dp[j] = dp[j-v[i]]-1;
		}
	}
	ll ans = 0ll;
	for(int i=0;i<=V;i++)if(dp[i]>=0)ans = max(ans,(base+i)*(base+sum-i));
	printf("%lld\n",ans-E);
	return 0;
}

Measured memory_bytes: 8176
import math

def makelist(n, m):
    return [[0 for _ in range(m)] for _ in range(n)]

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


X = int(input())

a = X // 100
b = X % 100
if X < 100:
    print(0)
elif b <= a * 5:
    print(1)
else:
    print(0)


Measured memory_bytes: 2940
def root(arr, index)
    while arr[index][1] != index
        index = arr[index][1]
    end
    index
end

N, M = gets.split.map{|n| n.to_i}

A = Array.new(M)
B = Array.new(M)
c = Array.new(M)

for i in 1..M
    A[i-1], B[i-1] = gets.split.map{|n| n.to_i}
end

pre = Array.new(N+1){|i| [1, i]}
c[0] = N * (N - 1) / 2

for i in 1..M-1
    x = root(pre, A[M-i])
    y = root(pre, B[M-i])
    c[i] = c[i-1]

    if x == y
        next
    end

    c[i] -= pre[x][0] * pre[y][0]

    pre[y][1] = x
    pre[B[M-i]][1] = x
    pre[x][0] += pre[y][0]
end

puts c.reverse

Measured memory_bytes: 13564
#include <bits/stdc++.h>
using namespace std;
long double ans=0;
void calc(long long n, long double sum)
{
  ans+=sum/(2*n);
  if (n==1) return;
  calc(n-1,sum-sum/n/n);
}
int main()
{
  long long n,d,x;
  cin>>n>>d>>x;
  long double sum=(d+d+(2*n-1)*x)*n;
  calc(n,sum);
  cout<<fixed<<setprecision(15)<<ans<<endl;
  return 0;
}

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

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define reps(i,s,n) for(int (i)=(s);(i)<(n);(i)++)
#define repr(i,n) for(int (i)=(n)-1;(i)>=0;(i)--)
#define forin(i,array) for(auto& x:array)
#define all(v) (v).begin(),(v).end()
#define pb push_back
#define mod 1000000007
#define inf 10000000000000


typedef long long ll;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef pair<int,int> pint;
typedef pair<ll,ll> pll;
typedef vector<pint> vpint;


int main(){

    int n,m;
    cin>>n>>m;
    int ans=0;
    repr(i,(int)pow(m,0.5)+1){
        if(i==0)continue;
        if(m%i==0){
            if(i<=m/n)ans=max(ans,i);
            if(m/i<=m/n)ans=max(ans,m/i);
        }
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
using namespace std;
int gcd( int m, int n )
{// ユークリッドの方法によりm,nの最大公約数を求める
    while( m != n )
    {
        if ( m > n ) m = m - n;
        else         n = n - m;
    }
    return m;
}//gcd

int main(){
    int k,l,m,n;
    cin >> m >>n >>l;
    k = gcd(m,n);
double a = (double)l/(double)k;
    if (ceil(a)==floor(a)){
        cout << "YES";
    }else{
        cout << "NO";
    }
    return 0;
}

Measured memory_bytes: 256
#include <iostream>

int main(){
    int n;
    std::cin >> n;
    int p[n];
    for(int i=0;i<n;i++){
        std::cin >> p[i];
    }
    int sum=0;
    for(int i=1;i<n-1;i++){
        int a=p[i-1];
        int b=p[i];
        int c=p[i+1];
        
        if(a>b&&b>c){
            sum++;
        } else if(c>b&&b>a){
            sum++;
        }
    }
    std::cout << sum << std::endl;
    return 0;
}


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

int main()
{
    int n, k;
    cin >> n >> k;

    int r, s, p;
    cin >> r >> s >> p;

    string t;
    cin >> t;

    char T[n];
    rep(i,n){
        if (i < k) {
            T[i] = t[i];
            continue;
        }

        if (T[i-k] == t[i]) {
            T[i] = '0';
        } else {
            T[i] = t[i];
        }
    }

    ll ans = 0;
    rep(i,n) {
        if (T[i] == 'r') ans += p;
        if (T[i] == 's') ans += r;
        if (T[i] == 'p') ans += s;
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 512
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
#include <stack>
#include <cmath>
#include <functional>
#define rep(i,n) for (int i=0;i<(n);i++)

using namespace std;

int main(){
	int tmp, i = 1;
	cin >> tmp;
	while (tmp != 0){
		cout << "Case " << i << ": " << tmp << endl;
			i++;
			cin >> tmp;
	}


	return 0;
}

Measured memory_bytes: 1156
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); ++i)
#define MOD 1000000007

using namespace std;
using ll = long long;

int main() {
	ll n, ans = 0;
	cin >> n;
	vector<ll> a(n), b(n);
	rep(i,n) cin >> a[i] >> b[i];
	sort(a.begin(), a.end());
	sort(b.begin(), b.end());
	int h = n / 2;
	if (n % 2 == 1) {
		ans = b[h] - a[h] + 1;
	}
	else {
		ans = b[h] + b[h - 1] - a[h] - a[h - 1];
		ans++;
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 6360
#include <bits/stdc++.h>
using namespace std;;
#define ll long long
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define INF 1<<30
#define LINF 1LL<<62
#define all(x) (x).begin(), (x).end()
#define mp make_pair
#define pb push_back
const int MOD = 1000000007;
 
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;

int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  int d; cin >> d;
  cout << "Christmas" ;
  REP(i, 25-d){
      cout << " Eve";
  }
  cout << endl;

}

Measured memory_bytes: 256
n,m,l=map(int,input().split())
a=[list(map(int,input().split()))for _ in range(n)]
b=[list(map(int,input().split()))for _ in range(m)]
[print(*x)for x in[[sum([s*t for s,t in zip(c,l)])for l in zip(*b)]for c in a]]

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

#ifdef DEBUG
#include "inc/debug.hpp"
#else
#define debug(...) 42
#endif

const int mod = 1e9+7;

long long modpow(long long a, long long n) {
    if (n == 0) return 1;
    if (n % 2) return (modpow(a, n-1) * a) % mod;
    long long t = modpow(a, n/2);
    return (t * t) % mod;
}

int main() {
    int N;
    cin >> N;
    vector<long long> A(N);
    for (int i=0; i<N; ++i) cin >> A[i];

    long long ans = 0;
    for (int i=0; i<60; ++i) {
        long long c0 = 0, c1 = 0;
        for (int j=0; j<N; ++j) {
            if ((A[j] >> i) & 1) c1 ++;
            else c0 ++;
        }
        long long t = (modpow(2, i) * ((c0 * c1) % mod)) % mod;
        (ans += t) %= mod;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 2560
# pragma comment(linker, "/STACK: 2000000")
# include <stdio.h>
# include <bits/stdc++.h>
using namespace std;
# define fi cin
# define fo cout
# define x first
# define y second
# define ll long long
# define IOS ios_base :: sync_with_stdio(0);cin.tie(0)
# define p(v) cerr << #v << " = " << v << '\n';
# define p2(v) cerr << #v << " = " << (complex < int > (v.x,v.y)) << '\n'
# define vi vector < int >
# define vll vector < ll >
# define pii pair < int , int >
int s[1 << 20];
int main(void)
{
    #ifdef CF
    freopen("input","r",stdin);
    #endif // CF
    srand(time(0));
    fo << fixed << setprecision(7);
    cerr << fixed << setprecision(7);
    int n,k;
    fi>>n>>k;
    for (int i = 1;i <= n;++i)
        fi>>s[i];
    int ans = s[1] != 1;
    s[1] = 1;
    static vector < int > t[1 << 20];
    for (int i = 2;i <= n;++i)
        t[s[i]].push_back(i);
    function < int(int,int) > dfs = [&](int node,int prev)
    {
        int mx = 0;
        for (auto it : t[node])
            mx = max(mx,dfs(it,node) + 1);
        if (mx == k - 1 && node != 1 && prev != 1) ++ans,mx -= k + 1;
        return mx;
    };
    dfs(1,0);
    fo << ans << '\n';
    return 0;
}

Measured memory_bytes: 36224
#include <stdio.h>
#include <stdlib.h>
#define MAX 2000001
#define VMAX 10000

int main(){
  unsigned short *A, *B;
  int C[VMAX+1];
  int n, i, j;

  scanf("%d", &n);

  A = malloc(sizeof(short)*n+1);
  B = malloc(sizeof(short)*n+1);

  for(i=0;i<=VMAX;i++){
    C[i]=0;
  }
  for(i=0;i<n;i++){
    scanf("%hu",&A[i+1]);
    C[A[i+1]]++;
  }

  for(i=1;i<=VMAX;i++){
    C[i]=C[i]+C[i-1];
  }
  for(j=1;j<=n;j++){
    B[C[A[j]]]=A[j];
    C[A[j]]--;
  }

  for(i=1;i<=n;i++){
    if(i>1) printf(" ");
    printf("%d",B[i]);
  }
  printf("\n");
  return 0;
}


Measured memory_bytes: 9652
#include<bits/stdc++.h>
#define ll long long
#define nl "\n"
#define pi acos(-1)
#define fast ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)
#define pcase printf("Case %d:\n",ca)
int ca=1;
int arr[10000];
using namespace std;
int main()
{
    fast;
    ll a,b,n;
    cin>>a>>b>>n;
    ll ans = (b/n)-(a/n);
        if(a%n==0){
            cout<<ans+1<<nl;
        }else{
              cout<<ans<<nl;
        }


}


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

int main() {
    int n, m;
    cin >> n >> m;
    int a[n];
    int suma = 0;
    rep(i,n) {
        cin >> a[i];
        suma += a[i];
    }
    sort(a, a+n, greater<>());
    string ans = "Yes";
    rep(i,m) {
        if (float(a[i]) < (float)suma / (4*m)) ans = "No";
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#!/usr/bin/env python3
import sys
sys.setrecursionlimit(300000)

YES = "Yes"  # type: str
NO = "No"  # type: str

def solve(N: int, K: int, Q: int, A: "List[int]"):
    p = [0] * N
    for j in range(Q):
        p[A[j] - 1] += 1
    for i in range(N):
        if K - Q + p[i] > 0:
            print(YES)
        else:
            print(NO)
    return


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    K = int(next(tokens))  # type: int
    Q = int(next(tokens))  # type: int
    A = [ int(next(tokens)) for _ in range(Q) ]  # type: "List[int]"
    solve(N, K, Q, A)

if __name__ == '__main__':
    main()


Measured memory_bytes: 8640
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define fs first
#define sc second
typedef pair<ll, ll> l_l;
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

int main(){
  int n;
  cin>>n;
  ll ans=1;
  rep1(i,n){
   ans=ans*i%((ll)pow(10,9)+7);
  }
  cout<<ans<<endl;
}

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

int main(){
    long long N,A,B,ans;
    cin>>N>>A>>B;
    if(A%2==B%2)ans=(B-A)/2;
    else ans=min(A-1,N-B)+1+(B-A-1)/2;
    cout<<ans<<endl;
}

Measured memory_bytes: 256
n = int(input())
h = list(map(int, input().split()))
flag = True
m = [h[n-1] for i in range(n)]
for i in reversed(range(n-1)):
    m[i] = min(m[i+1], h[i])
for i in range(n):
    if h[i] - m[i] > 1:
        flag = False
if flag:
    print("Yes")
else:
    print("No")


Measured memory_bytes: 15020
#include<iostream>
#include<vector>
#include<algorithm>

using namespace std;

int main(void){
  int n, c, k, t, people = 1, t_min, busNum = 1;
  vector<int> v;
  cin >> n >> c >> k;
  for(int i = 0; i < n; i++){
  	cin >> t;
    v.push_back(t);
  }
  sort(v.begin(), v.end());
  t_min = v[0];
  for(int i = 1; i < n;i++){
    people++;
    if(c < people || t_min+k < v[i]){
      busNum++;
      people = 1;
      t_min = v[i];
    }
  }
  cout << busNum << endl;
  
  return 0;
}

Measured memory_bytes: 892
#include<bits/stdc++.h>
using namespace std;
#define inf 1000000000
#define INF 1000000000000000
#define ll long long
#define ull unsigned long long
#define M (int)(1e9+7)
#define P pair<int,int>
#define PLL pair<ll,ll>
#define FOR(i,m,n) for(int i=(int)m;i<(int)n;i++)
#define RFOR(i,m,n) for(int i=(int)m;i>=(int)n;i--)
#define rep(i,n) FOR(i,0,n)
#define rrep(i,n) RFOR(i,n,0)
#define all(a) a.begin(),a.end()
#define IN(a,n) rep(i,n){ cin>>a[i]; }
const int vx[4] = {0,1,0,-1};
const int vy[4] = {1,0,-1,0};
#define PI 3.14159265
#define F first
#define S second
#define PB push_back
#define EB emplace_back
void init(){
  cin.tie(0);
  ios::sync_with_stdio(false);
}


int n;
string s;

int main(){
  cin>>n;
  cin>>s;

  int a=0,b=0;
  rep(i,n){
    if(s[i]=='.') b++;
  }
  int ans=inf;

  rep(i,n+1){
    ans=min(ans,a+b);
    if(i==n) break;
    if(s[i]=='#')
      a++;
    else
      b--;
  }

  cout<<ans<<endl;
}


Measured memory_bytes: 640
#![allow(clippy::needless_range_loop)]
#![allow(unused_macros)]
#![allow(dead_code)]
#![allow(unused_imports)]

use itertools::Itertools;
use proconio::input;
use proconio::marker::*;

fn main() {
    input! {
        s: String,
    }

    if s.as_bytes()[s.len() - 1] == b's' {
        println!("{}es", s);
    } else {
        println!("{}s", s);
    }
}


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

using namespace std;

int main() {
  int x;
  cin >> x;
  
  
  bool isPrime = false;
  
  while(!isPrime){
    for(int i = 2;;i++){
      if(i*i > x){
        isPrime = true;
        break;
      }
      if(x%i==0){ 
        x++;
        break; }
    }
    
  }
  
  cout << x << endl;
}


Measured memory_bytes: 3608
#include<iostream>
#include<cstdio>
using namespace std;
int main()
{
    int n;
    while(scanf("%d",&n)!=EOF)
    {
        if(n<1200)
        {
            printf("ABC\n");
            continue;
        }
        else if(n<2800)
        {
            printf("ARC\n");
            continue;
        }
        printf("AGC\n");
    }
    return 0;
}


Measured memory_bytes: 256