akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <iosfwd>
#include <iomanip>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <ctime>
#include <cmath>
#include <cassert>
#include <cctype>
#include <climits>
#include <vector>
#include <bitset>
#include <set>
#include <queue>
#include <stack>
#include <map>
#include <deque>
#include <string>
#include <list>
#include <iterator>
#include <sstream>
#include <complex>
#include <fstream>
#include <functional>
#include <numeric>
#include <utility>
#include <algorithm>
#include <assert.h>
#include <unordered_map>

using namespace std;
const int N = 6e5 + 500;
const int LN = 21;
const long long mod = 1e9 + 7;
const long long INF = 1LL << 57;

long long n, m, u, v, k, t, q, a, x, d, b;


int main() {
   ios::sync_with_stdio(false);cin.tie(0);
   cin >> n >> u >> v;
   cout << min(n * u, v) << endl;
}







Measured memory_bytes: 256
/*
Given a 2D matrix, find the maximum cost of every shortest path 


BFS - Find the shortest path

*/

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

using ll = long long; 

int h;
int w;

// Find the furtherest neighbours starting at (start_i, start_j)
int bfs(vector<vector<char>> mat, int start_i, int start_j) {
    vector<vector<bool>> visited(h, vector<bool>(w));
    
    int level = 1;
    
    int last_valid = 0;
    
    queue<pair<int, int>> q;
    
    vector<pair<int, int>> dirs = {{-1, 0}, {1, 0}, {0, -1}, {0, 1}}; // up down left right
    
    visited[start_i][start_j] = true;
    
    q.push({start_i, start_j});
    
    while (!q.empty()) {
        int sz = q.size();
        for (int i = 0; i < sz; i++) {
            pair<int, int> p = q.front();
            q.pop();
            for (pair<int, int> dir : dirs) {
                int di = dir.first + p.first;
                int dj = dir.second + p.second;
                if (di >= 0 && dj >= 0 && di < h && dj < w && mat[di][dj] == '.' && !visited[di][dj]) {
                    last_valid = level;
                    visited[di][dj] = true;
                    q.push({di, dj});
                }
            }
        }
        level += 1;
    }
    
    return last_valid;
}

int main() {
    scanf("%d%d", &h, &w);
    vector<vector<char>> mat(h, vector<char>(w));
    
    for (int i = 0; i < h; i++) {
        for (int j = 0; j < w; j++) {
            cin >> mat[i][j];
        }
    }
    
    int ans = 0;
    
    for (int i = 0; i < h; i++) {
        for (int j = 0; j < w; j++) {
            if (mat[i][j] == '.') {
                ans = max(ans, bfs(mat, i, j));    
            }
        }
    }
    
    cout << ans << endl;
	
	return 0;
}

Measured memory_bytes: 256
parseInt(x) = parse(Int, x)
parseMap(x::Array{SubString{String},1}) = map(parseInt, x)

function main()
	k = readline() |> parseInt
	a = Int8[1,1,1,2,1,2,1,5,2,2,1,5,1,2,1,14,1,5,1,5,2,2,1,15,2,2,5,4,1,4,1,51]
	println(a[k])
end

main()

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

using namespace std;

const int maxn = 4010;

long long freql[3][maxn], freqr[3][maxn];

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

    int n;

    cin >> n;

    string s;

    cin >> s;

    n = (int)s.size();

    long long ans = 0;

    for(int i=0; i<n; i++){
        memset(freql, 0, sizeof freql);
        memset(freqr, 0, sizeof freqr);
        for(int j=1; j<=n; j++){
            int d = abs(i-(j-1));
            if(i == j-1)continue;
            if(s[j-1] == 'R'){
                if(i<(j-1)) freql[0][d]++;
                else freqr[0][d]++, freqr[0][n+1]++;
            }
            if(s[j-1] == 'G'){
                if(i<(j-1)) freql[1][d]++;
                else freqr[1][d]++, freqr[1][n+1]++;
            }
            if(s[j-1] == 'B'){
                if(i<(j-1)) freql[2][d]++;
                else freqr[2][d]++, freqr[2][n+1]++;
            }
        }
        for(int j=1; j<=n; j++){
            int d = j;
            if(s[i] == 'B'){
                ans += freql[0][d] * (freqr[1][n+1] - freqr[1][d]);
                ans += freql[1][d] * (freqr[0][n+1] - freqr[0][d]);
            }
            if(s[i] == 'G'){
                ans += freql[0][d] * (freqr[2][n+1] - freqr[2][d]);
                ans += freql[2][d] * (freqr[0][n+1] - freqr[0][d]);
            }
            if(s[i] == 'R'){
                ans += freql[1][d] * (freqr[2][n+1] - freqr[2][d]);
                ans += freql[2][d] * (freqr[1][n+1] - freqr[1][d]);
            }
        }
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 3868
#include<iostream>
using namespace std;
//Dinic O(EV^2)
#include<algorithm>
#include<utility>
#include<vector>
#include<queue>
#include<limits>
template<typename T>
struct MF{
	struct edge{
		int to,rev;
		T cap;
	};
	vector<vector<edge> >G;
	vector<int>level,iter;
	MF(int n_=0):G(n_),level(n_),iter(n_){}
	void add_edge(int from,int to,T cap)
	{
		G[from].push_back({
			to,(int)G[to].size(),cap
		});
		G[to].push_back({
			from,(int)G[from].size()-1,0
		});
	}
	T dfs(int u,int t,T f)
	{
		if(u==t)return f;
		for(;iter[u]<G[u].size();iter[u]++)
		{
			edge&e=G[u][iter[u]];
			if(e.cap>0&&level[u]<level[e.to])
			{
				T d=dfs(e.to,t,min(f,e.cap));
				if(d>0)
				{
					e.cap-=d;
					G[e.to][e.rev].cap+=d;
					return d;
				}
			}
		}
		return 0;
	}
	T max_flow(int s,int t)
	{
		T ret=0;
		for(;;)
		{
			fill(level.begin(),level.end(),-1);
			queue<int>P;
			level[s]=0;
			P.push(s);
			while(!P.empty())
			{
				int u=P.front();P.pop();
				for(edge&e:G[u])
				{
					if(e.cap>0&&level[e.to]<0)
					{
						level[e.to]=level[u]+1;
						P.push(e.to);
					}
				}
			}
			if(level[t]<0)return ret;
			fill(iter.begin(),iter.end(),0);
			for(T f;(f=dfs(s,t,numeric_limits<T>::max()))>0;)ret+=f;
		}
	}
};
main()
{
	int N,E;
	cin>>N>>E;
	MF<int>mf(N);
	for(int i=0;i<E;i++)
	{
		int u,v,c;cin>>u>>v>>c;
		mf.add_edge(u,v,c);
	}
	cout<<mf.max_flow(0,N-1)<<endl;
}


Measured memory_bytes: 3204
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace CSharpConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
          Paper_Please();
        }
        static void Paper_Please()
        {
            int N = int.Parse(Console.ReadLine());
            int[] arr = Array.ConvertAll<string, int>(Console.ReadLine().Split(' '), int.Parse);
            bool isApprove = true;
            for(int i = 0; i < N; i++)
            {
                if (arr[i] % 2 == 0)
                {
                    if(arr[i] % 3==0 || arr[i] % 5 == 0)
                    {

                    }
                    else
                    {
                        isApprove = false;
                    }
                }
            }
            if (isApprove)
            {
                Console.WriteLine("APPROVED");
            }
            else
            {
                Console.WriteLine("DENIED");
            }
        }
    }
}


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

using namespace std;

#define fi first
#define se second
#define ll long long


int main(){
	ll n,d,a;
	scanf("%lld%lld%lld",&n,&d,&a);
	vector<pair<ll,ll> > arr(n);
	for(int i=0;i<n;i++){
		scanf("%lld%lld",&arr[i].fi,&arr[i].se);
	}
	sort(arr.begin(),arr.end());
	vector<ll> cnt(n+1);
	ll i=0,j=0,res=0;
	while(i<n){
		if(arr[i].se>cnt[i]){
			ll v=arr[i].se-cnt[i];
			ll bomb=v/a;
			if(v%a!=0)
				bomb++;
			res+=bomb;
			ll dis=arr[i].fi+2*d;
			while(j<n&&arr[j].fi<=dis){
				j++;
			}
			cnt[i]+=(bomb*a);
			cnt[j]-=(bomb*a);
		}
		cnt[i+1]+=cnt[i];
		i++;
	}
	printf("%lld\n",res);
}


Measured memory_bytes: 4992
#include <bits/stdc++.h>
#define rep(i,n) for (int (i) = 0; (i) < (n); i++)
#define ll long long
using namespace std;
int main() {
  int N = 0,M = 0;
  cin >> N;
  vector<string>A(N);
  set<string> set;
  rep(i,N){
    cin >> A[i];
    set.insert(A[i]);
  }
  if(N != set.size()){
    cout << "No";
    return 0;
  }
  rep(i,N - 1){
    M = A[i].size();
    if(A[i].at(M - 1) != A[i + 1].at(0)){
      cout << "No";
      return 0;
    }
  }
    cout << "Yes";
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(void) {
	int A, B, C;
	cin >> A>> B>>C;

	if (A==B && A!= C)
	{
		cout << C << endl;

	}
	if (A == C && A != B)
	{
		cout << B << endl;
	}
	if (C == B && A != C)
	{
		cout << A << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define all(x) x.begin(), x.end()
#define pii pair<int, int>
#define pll pair<ll, ll>
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define em emplace
#define rep(i, n) for(int i = 0; i < n; i++)
#define REP(i, n) for(int i = 1; i <= n; i++)
template<class T> inline int chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline int chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
constexpr int INF = 1<<30;
constexpr ll LINF = 1LL<<58;
constexpr int mod = 1000000007;

int main(){
    int h, w;
    cin >> h >> w;
    string board[1010];
    for (int i = 0; i < h; i++) cin >> board[i];
    ll dp[1010][1010] = {0LL};
    for (int i = 0; i < 1010; i++) {
        if(board[0][i] == '#')break;
        dp[0][i] = 1;
    }
    for (int i = 0; i < 1010; i++) {
        if(board[i][0] == '#') break;
        dp[i][0] = 1;
    }
    for (int i = 1; i < h; i++) {
        for (int j = 1; j < w; j++) {
            if(board[i][j] == '#') continue;
            dp[i][j] = (dp[i - 1][j] + dp[i][j - 1]) % mod;
        }
    }
    cout << dp[h-1][w-1] << endl;
    return 0;
}

Measured memory_bytes: 9216
#include <stdio.h>

int main(){
    int N, M;
    scanf("%d %d", &N, &M);

    int a[M], b[M], keys[N];
    for(int i = 0; i < M; i++){
        scanf("%d %d", &a[i], &b[i]);
    }

    for(int i = 0; i < N; i++){
        keys[i] = 0;
    }

    for(int i = 0; i < M; i++){
        keys[a[i] - 1]++;
        keys[b[i] - 1]++;
    }

    for(int i = 0; i < N; i++){
        printf("%d\n", keys[i]);
    }
    return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>  
   
using namespace std;  
const int N = 200005;  
typedef long long ll;  
int a[N];  
int b[N];  
int main()  
{  
    int n;  
    cin>>n;  
    for(int i=1;i<=n;i++){  
        cin>>a[i];  
        b[i]=a[i];  
   }  
   sort(a+1,a+1+n);  
    int mid=n/2;  
    for(int i=1;i<=n;i++){  
        if(b[i]<=a[mid])  
        printf("%d\n",a[mid+1]);  
        else  
        printf("%d\n",a[mid]);  
    }  
}  

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

using namespace std;

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

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

typedef long long ll;
const int INF = 2147483647;
const double EPS = 1e-8;
const int MOD = 1000000007;
int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
struct RMQ{
  vector<int> data;
  int N;
  int top(){
    return data[0];
  }
  RMQ(int n){
    N = 1;
    while(N < n) N *= 2;
    data = vector<int>(2 * N, INF);
  }
  inline void update(int k, int x){
    data[k + N - 1] = x;
  }
  void build(){
    for(int k = N - 2; k >= 0; k--){
      data[k] = min(data[2 * k + 1], data[2 * k + 2]);
    }
  }
  int query(int a, int b, int MIN){
    return query(a, b, 0, 0, N, MIN);
  }
  int query(int a, int b, int k, int l, int r, int MIN){
    if(b <= l || r <= a) return INF;
    else if(a <= l && r <= b){
      return data[k];
    }else if(MIN <= data[k]){
      return MIN;
    }else{
      return min(query(a, b, 2 * k + 1, l, (l + r) / 2, MIN), query(a, b, 2 * k + 2, (l + r) / 2, r, MIN));
    }
  }
};

int main(){
  int H, W, Q;
  while(cin>>H>>W>>Q && H){
    if(H < W){
      //HlogW * Q = 10^7log10^3
      vector<RMQ> rmq(H, RMQ(W));
      REP(y, H){
        REP(x, W){
          int t; scanf("%d", &t);
          rmq[y].update(x, t);
        }
        rmq[y].build();
      }
      REP(i, Q){
        int y1, x1, y2, x2;
        scanf("%d %d %d %d", &y1, &x1, &y2, &x2);
        int res = INF;
        for(int y = y1; y <= y2; y++){
          res = min(res, rmq[y].query(x1, x2 + 1, res));
        }
        printf("%d\n", res);
      }
    }else{
      //WlogH * Q
      vector<RMQ> rmq(W, RMQ(H));
      REP(y, H){
        REP(x, W){
          int t; scanf("%d", &t);
          rmq[x].update(y, t);
        }
      }
      REP(x, W) rmq[x].build();
      REP(i, Q){
        int y1, x1, y2, x2;
        scanf("%d %d %d %d", &y1, &x1, &y2, &x2);
        int res = INF;
        for(int x = x1; x <= x2; x++){
          res = min(res, rmq[x].query(y1, y2 + 1, res));
        }
        printf("%d\n", res);
      }
    }
  }
  return 0;
}

Measured memory_bytes: 17492
#include <iostream>
#include <vector>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <stack>
#include <queue>
#include <algorithm>
#include <list>
#include <cstdio>
#include <cstdlib>
#include <climits>
#include <numeric>
#include <cmath>
#include <memory.h>
#include <algorithm>
#include <cassert>
using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<double, int> pdi;
typedef pair<double, double> pdd;
typedef pair<ll, int> pli;
typedef vector<vector<int>> vvi;
#define mod 10000
#define PI acos(-1.0)
#define eps 1e-8
#define e 2.71828

typedef long long ll;

int main(){
    ll n, a , b;
    cin >> n >> a >> b;
    ll res;
    if (a > b) {
        res = 0;
    } else if (n == 1 && a != b) {
        res = 0;
    } else {
        res = (n - 2) * (b - a) + 1;
    }
    cout << res;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <vector>
#include <stdio.h>


using namespace std;

int factorial(int n){
    if (n == 0 || n == 1){
        return 1;
    }
    return n * factorial(n - 1);
}

int combination(int n, int r){
    if (r == 0){
        return 1;
    }
    return factorial(n) / (factorial(n - r) * factorial(r));
}


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

    vector<int> x(N);
    vector<int> y(N);
    
    
    for (int i = 0; i < N; i++){
        cin >> x[i];
        cin >> y[i];
    }

    int factorial_n = factorial(N);

    int num_passed = factorial_n * (N - 1) / combination(N, 2);

    long double sum_distance = 0;
    for (int i = 0; i < N - 1; i++){
        for (int j = i + 1; j < N; j++){
            sum_distance += pow(pow(x[i] - x[j], 2) + pow(y[i] - y[j], 2), 0.5) * num_passed;
        }
    }

    printf("%10Lf\n", sum_distance / (long double) factorial_n);
    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;
 
public class Main {
 
    public static void main(String[] args){
 
        Scanner scan = new Scanner(System.in);
 
        int n = scan.nextInt();
        MSTree mst = new MSTree(n);
 
        for (int y = 0; y < n; y++)
            for (int x = 0; x < n; x++)
                mst.setLeng(x, y, scan.nextInt());
 
        System.out.println(mst.getMinTree());
 
        scan.close();
        System.exit(0);
    }
}
 
class MSTree {
    int[][] leng;
    int[] reach;
 
    public MSTree(int n) {
        leng = new int[n][n];
        reach = new int[n];
        for (int i = 0; i < n; i++)
            reach[i] = -1;
    }
 
    public int getMinTree() {
        int min = Integer.MAX_VALUE;
        int xx = 0, yy = 0;
        for (int x = 0; x < leng.length; x++)
            for (int y = x + 1; y < leng[x].length; y++)
                if (leng[x][y] !=-1 && leng[x][y] < min) {
                    xx = x;
                    yy = y;
                    min = leng[x][y];
                }
        reach[xx] = 0;
        reach[yy] = min;
        for (int i = 2; i < reach.length; i++)
            nextMin();
 
        int total = 0;
        for (int i = 0; i < reach.length; i++)
            total += reach[i];
        return total;
    }
 
    private void nextMin() {
        int min = Integer.MAX_VALUE;
        int xx = 0, yy = 0;
        for (int x = 0; x < leng.length; x++) {
            if (reach[x] == -1)
                continue;
            for (int y = 0; y < leng[x].length; y++) {
                if (reach[y] != -1||leng[x][y]==-1)
                    continue;
                if (leng[x][y] < min) {
                    xx = x;
                    yy = y;
                    min = leng[x][y];
                }
            }
        }
        reach[yy] = min;
    }
 
    public void setLeng(int x, int y, int length) {
        leng[x][y] = length;
    }
}

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

int main() {
  int a , b , O ;
  cin >> a >> b ;
  
  O = a * b ;
  
  if(O % 2 == 0) {
    cout << "Even" << endl;
  }
  
 
  if(O % 2 == 1) {
    cout << "Odd" << endl;
  }
  
}

Measured memory_bytes: 256
fun main(args: Array<String>){
    val (n, m) = readLine()!!.split(" ").map { it.toInt() }
    val g = Array(n+1){ mutableListOf<Pair<Int,Int>>() }
    repeat(m){
        val (l, r, d) = readLine()!!.split(" ").map { it.toInt() }
        g[l].add(Pair(r, d))
        g[r].add(Pair(l, -d))
    }
    val visited = BooleanArray(n+1){false}
    val x = IntArray(n+1)

    fun dfs(now: Int): Boolean{
        visited[now] = true
        var f = true
        g[now].forEach {
            if(visited[it.first] && x[it.first] - x[now] != it.second){
                f = false
            }
            if(!visited[it.first]){
                x[it.first] = x[now] + it.second
                f = f && dfs(it.first)
            }
        }
        return f
    }

    var f = true
    for(i in 1..n){
        if(!visited[i]) {
            f = f && dfs(i)
        }
    }
    if(f) println("Yes") else println("No")
}

Measured memory_bytes: 118940
#include <bits/stdc++.h>
#define REP(i, n) for(ll i = 0; i < (ll)n; i++)
#define FOR(i, a, b) for(ll i = (a); i < (ll)b; i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define INF (1ll << 60)
#define sz(x) int(x.size())
using namespace std;
typedef long long ll;
typedef double db;
typedef string str;
typedef pair<ll, ll> p;
constexpr int MOD = 1000000007;
using ll = long long;
template <class T> inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return true;
    }
    return false;
}
template <class T> inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}

void print(const std::vector<int> &v) {
    std::for_each(v.begin(), v.end(), [](int x) { std::cout << x << " "; });
    std::cout << std::endl;
}

int main() {
    ll X;
    cin >> X;
    //右に生きたい時とりあえず左いってから右にいくことで1ます
    //もしくは２回右に行く
    ll now = 0;
    int time = 0;
    while(X > now) {
        time++;
        now += time;
    }
    cout << time << endl;
    return 0;
}

Measured memory_bytes: 256
def main inputs
  inputs = inputs.dup
  size, quantum = inputs.shift.split(' ').map{|n|n.to_i}
  time = 0
  done = []
  until inputs.empty?
    target_name, target_rest = inputs.shift.split ' '
    # target 180, quantum 100?????¨???
    # ??????????????£??????????????? 100
    # ???????????? 80
    #
    # target 80, quantum 100?????¨???
    # ??????????????£??????????????? 80
    # ???????????? 0
    #
    # ????????????
    rest = target_rest.to_i - quantum
    # ????????????????????´???
    if rest <= 0
      time = time + target_rest.to_i
      done.push("#{target_name} #{time}")
    else
      # ??????????????????????????´???
      time = time + quantum
      # ????????´???
      inputs.push "#{target_name} #{rest}"
    end
  end
  done.join "\n"
end


inputs = STDIN.read.split(/\n/)

puts main(inputs)

Measured memory_bytes: 16264
def calc(y, m):
    y += 1
    m += 1
    if m % 2 == 1:
        return 20
    if y % 3 == 0:
        return 20
    else:
        return 19


date = [ [ [0 for k in range(calc(i, j))] for j in range(10)] for i in range(1000)]

count = 0
for i in range(1000):
    for j in range(10):
        for k in range(calc(i,j)):
            date[i][j][k] = count
            count += 1

last = date[999][0][0]

n = int(input())
for i in range(n):
    y, m, d = map(int, input().split(' '))
    print(last - date[y-1][m-1][d-1])



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

int main(){
	string str, ans;
	
	while( getline(cin, str) ){
		bool flag = false;
		ans = "";
		for( int i = 0; i < str.size(); i++ ){
			if( str[i] == ' ' || str[i] == '.' || str[i] == ',' ){
				if( 3 <= ans.size()  && ans.size() <= 6 ){
					if( flag ){
						cout << " " << ans;
					}else{
						flag = true;
						cout << ans;
					}
				}
				ans = "";
			}else{
				ans += str[i];
			}
 		}
 		cout << endl;
	}
	
}

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

int main(){
  
  int h,a,ans=0;
  cin >> h >> a;
  
  ans = h/a;
  if(h%a>0) ans++;
  
  cout << ans;
  
}

Measured memory_bytes: 256
#include<stdio.h>
int main()
{
int a,b,k;
scanf("%d%d%d",&a,&b,&k);
int i;
if(k*2>=b-a+1)
    for(i=a;i<=b;i++)

    printf("%d\n",i);
else
    {
        for(i=1;i<=k;i++)
    printf("%d\n",a++);
        int x=b-k+1;
        for(i=1;i<=k;i++)
            printf("%d\n",x++);
    }

return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <iomanip>
#include <vector>
#include <set>
#include <string>
#include <queue>
#include <algorithm>
#include <map>
#include <cmath>
#include <list>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cstring>

#define rep(i, n) for (int i = 0; i < n; i++)

using namespace std;
typedef vector<int> vi;
typedef pair<int, int> pii;

const int INF = 1 << 30;
const long long INFL = 1LL << 60;
const int MOD = 1000000007;
const int MAX = 100000;
const int N = 100;

int main() {
	string S;cin>>S;
	cout << S[0] << S.size()-2 << S[S.size()-1] << endl;
}


Measured memory_bytes: 384
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
#from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left,bisect_right
from heapq import heapify, heappop, heappush
from math import floor, ceil,pi
#from operator import itemgetter
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def LI2(): return [int(input()) for i in range(n)]
def MXI(): return [LI()for i in range(n)]
inf = 10**17
mod = 10**9 + 7

n=I()
A=LI()
sm=0
ans=[0 for i in range(n)]
for i in range((n-1)//2):
    sm+=2*A[2*i+1]
ans[0]=sum(A)-sm
for i in range(n-1):
    ans[i+1]=-ans[i]+2*A[i]
print(*ans)

Measured memory_bytes: 14484
package main

import (
	"bufio"
	"fmt"
	"os"
)

func main() {
	scanner := bufio.NewScanner(os.Stdin)

	nextWeather := make(map[string]string)
	nextWeather["Sunny"] = "Cloudy"
	nextWeather["Cloudy"] = "Rainy"
	nextWeather["Rainy"] = "Sunny"

	scanner.Scan()
	fmt.Println(nextWeather[scanner.Text()])

}


Measured memory_bytes: 1752
import java.util.Scanner;

public class Main{
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int stay = scanner.nextInt();
		int day = scanner.nextInt();
		int cost1 = scanner.nextInt();
		int cost2 = scanner.nextInt();

		if(stay <= day) {
			System.out.println(stay * cost1);
		}else if(stay > day){
			System.out.println(day * cost1 + (stay - day) * cost2);
		}

		scanner.close();
	}
}

Measured memory_bytes: 21844
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <cmath>
#include <cstring>
#include <iomanip>
#include <random>
#include <chrono>
#include <queue>
#include <math.h>

using namespace std;


int main(){
    int n,k;
    cin >> n >>k;
    double ans=0.0;
    for (int i=1;i<=n;i++){
        double t=log2(k)-log2(i);
        if(t<0){
            double r=n;
            ans+=1.0/r;
        }
        else{
            t=ceil(t);
            double e=n*pow(2,t);
            ans+=1.0/e;
        }
    }
     printf("%.12f\n",ans);
}


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

using namespace std;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(),v.end()
#define _GLIBCXX_DEBUG
void dfs(int frm,int now,int nowcolor,vector<int> &color,vector<vector<pair<int,int>>> &d){
        for (int i=0;i<d[now].size();i++){
            if (d[now][i].first==frm){
                continue;
            }
            else if (d[now][i].second%2==1){
                color[d[now][i].first]=1-nowcolor;
                dfs(now,d[now][i].first,1-nowcolor,color,d);
            }
            else{
                color[d[now][i].first]=nowcolor;
                dfs(now,d[now][i].first,nowcolor,color,d);
            }
        }

}
int main() {
    int n;
    cin>>n;
    int u,v;
    long w;
    vector<vector<pair<int,int>>> d(n+1);
    pair<int,int> p;
    rep(i,n-1){
        cin>>u>>v>>w;
        p=make_pair(v,w%2);
        d[u].push_back(p);
        p=make_pair(u,w%2);
        d[v].push_back(p);
    }
    vector<int> color(n+1);
    color[1]=1;
    dfs(1,1,1,color,d);
    for (int i=1;i<n+1;i++){
        cout<<color[i]<<endl;
    }
    return 0;
}

Measured memory_bytes: 11648
fn input_line() -> Vec<String> {
  let mut buf = String::new();
  std::io::stdin().read_line(&mut buf).unwrap();
  return buf
    .split_whitespace()
    .map(|word| String::from(word))
    .collect();
}

fn main() {
  let inputs = input_line();
  let x: i64 = inputs[0].parse().unwrap();
  let k: i64 = inputs[1].parse().unwrap();
  let d: i64 = inputs[2].parse().unwrap();

  let plus_x = if x < 0 {
    -x
  } else {
    x
  };

  let x_per_d = plus_x / d;

  let ans = if k <= x_per_d {
    plus_x - d * k
  } else {
    let x_mod_d = plus_x % d;

    if (k - x_per_d) % 2 == 0 {
      x_mod_d
    } else {
      -(x_mod_d - d)
    }
  };

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

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

int main(){
  
  string S_, Ans="";
  int n;
  map<string, int> S;
  cin>>n;
  
  for(int i=0; i<n; i++){
    cin>>S_;
    sort(S_.begin(), S_.end());
    
    for(int j=0; j<(int)S_.size(); j++){
      
      int l=1;
      do{
        S[S_.substr(j, l)]++;
        l++;
        if(j+l-1>=(int)S_.size()) break;
      }while(S_[j]==S_[j+l-1]);
      j+=l-2;
    }
  }
  
  for(auto it=rbegin(S); it!=rend(S); it++){
    
    if(it->second==n){
      Ans+=it->first;
      advance(it, it->first.size()-1);
    }
  }
  reverse(Ans.begin(), Ans.end());
  cout<<Ans<<endl;
  return 0;
}

Measured memory_bytes: 3576
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <vector>
using namespace std;

int main() {
    int a, b, c; 
    long long t = 0;
    scanf("%d %d %d", &a, &b, &c);
    if((a&1) || (b&1) || (c&1));
    else if(a==b && b==c) t = -1;
    else {
	while(!(a&1) && !(b&1) && !(c&1)) {
	    int ta = a>>1, tb = b>>1, tc = c>>1;
	    a = tb+tc;
	    b = ta+tc;
	    c = ta+tb;
	    ++t;
	}
    }
    printf("%lld\n", t);
    return 0;
}


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

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

    string s;
    cin >> s;

    int r = 1;
    if (s.size() != a + b + 1 || s[a] != '-') {
        r = 0;
    } else {
        for (int i = 0; i < a; i++) {
            if (!('0' <= s[i] && s[i] <= '9')) r = 0;
        }
        for (int i = 0; i < b; i++) {
            if (!('0' <= s[i + a + 1] && s[i + a + 1] <= '9')) r = 0;
        }
    }

    cout << (r ? "Yes" : "No") << endl;

    return 0;
}

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

#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define RREP(i,n) for(int i=n-1;i>=0;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, m;
vector<int> v;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);

  cin >> n >> m;
  vector<bool> v(n + 1, true);
  REP(i, m) {
    int a;
    cin >> a;
    v[a] = false;
  }

  vector<int> memo(n + 1, 0);
  memo[0] = 1;
  FOR(i, 1, n + 1) {
    if(v[i]) {
      if(i == 1) memo[i] = memo[i - 1] % mod;
      else memo[i] = (memo[i - 1] + memo[i - 2]) % mod;
    } else {
      memo[i] = 0;
    }
  }

  cout << memo[n] << endl;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
#define ll          long long int
#define pii         pair<int,int>
#define uu          first
#define vv          second
#define fastIO      ios::sync_with_stdio(0);cin.tie(0);
using namespace std;

const int MAX = 1e6 + 6;
int main()
{
    fastIO;
    int n, W;
    cin>>n>>W;
    vector<ll>w(n+1), val(n+1);
    vector< vector<ll> > dp(n+1, vector<ll>(W+1));
    
    for(int i =1 ; i <=n ; i++ ) cin>>w[i]>>val[i];
    
    for(int i =1 ; i <=n ; i++ ) {
        for(int j = 1 ; j <=W ; j++ ) {
            dp[i][j] = dp[i-1][j];
            
            if(j - w[i] >= 0) dp[i][j] = max(dp[i][j], dp[i-1][j - w[i]] + val[i]);
        }
    }
    cout<<dp[n][W]<<'\n';
    
    return 0;
}

Measured memory_bytes: 83016
#include "iostream"
#include "stdio.h"
#include "math.h"
#include<algorithm>//排序sort()
#include "vector"
#include "cstring" //strcmp
#include "string"
#include "set"
#include "stack"
#include "vector"
#include "map"
#include "queue"
using namespace std;

const int maxn=52;
const int maxk=100;

int main()
{
    int n,k,r;
    int A[maxn],ans[maxn]={0};
    scanf("%d%d",&n,&k);
    for (int i = 1; i <= n; ++i) {
        scanf("%d",A+i);
    }
    int result=0;
    r=min(n,k);
    for (int a = 0; a <= r; ++a) {
        for (int b = 0; b <=r-a ; ++b) {

            int pans=0,sum=0;
            int c=k-a-b;//从盘子拿走的次数

            for (int i = 1; i <= a; ++i) {
                ans[pans++]=A[i];
            }
            for(int i = n ; i > n-b;--i){
                ans[pans++]=A[i];
            }
            sort(ans,ans+pans);
            int i=0;
            while(i < c && ans[i]<0){
                i++;
            }
            for (int j = i; j < pans; ++j) {
                sum+=ans[j];
            }
            result =max(sum,result);
        }
    }

    cout<<result;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int N=1e5+1;// number of elements
long long a[N];
map<pair<long long,long long>,long long>m;
struct segment_tree
{
	long long tree[N*4];
	void setAr(long long x,long long l,long long r)//set values to all leaves
	{
		if(l==r)
		{
			tree[x]=l;
			return;
		}
		this->setAr(x*2,l,(l+r)>>1);
		this->setAr(x*2+1,(l+r)/2+1,r);
		if(a[tree[x*2]]>a[tree[x*2+1]])tree[x]=tree[x*2];
		else tree[x]=tree[x*2+1];
	}
	long long RMQ(long long x,long long l,long long r,long long L,long long R)
	{
		if(L<=l && r<=R)return tree[x];
		long long f=0,ansl,ansr;
		if(L<=(l+r)/2)
		{
			ansl=this->RMQ(x*2,l,(l+r)>>1,L,R);
			f|=1;
		}
		if((l+r)/2<R)
		{
			ansr=this->RMQ(x*2+1,(l+r)/2+1,r,L,R);
			f|=2;
		}
		if(f==1)return ansl;
		if(f==2)return ansr;
		if(a[ansl]>a[ansr])return ansl;
		return ansr;
	}
}T;
int n;
long long fin(long long l,long long r)
{
	long long ans;
	if(l>=r)return 0;
	if(m.find({l,r})!=m.end())return m[make_pair(l,r)];
	long long ma=T.RMQ(1,1,n,l,r),ma2,ma3;
	if(ma==l)ma2=T.RMQ(1,1,n,l+1,r);
	else if(ma==r)ma2=T.RMQ(1,1,n,l,r-1);
	else
	{
		ma2=T.RMQ(1,1,n,l,ma-1);
		ma3=T.RMQ(1,1,n,ma+1,r);
		if(a[ma3]>a[ma2])ma2=ma3;
	}
	ans=a[ma2]*(min(ma,ma2)-l+1)*(r-max(ma,ma2)+1);
	ans+=fin(l,max(ma,ma2)-1)+fin(min(ma,ma2)+1,r)-fin(min(ma,ma2)+1,max(ma,ma2)-1);
	return m[make_pair(l,r)]=ans;
}
int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	long long  i;
	cin>>n;
	for(i=1;i<=n;i++)
		cin>>a[i];
	T.setAr(1,1,n);
	cout<<fin(1,n)<<'\n';
}


Measured memory_bytes: 62720
#include<stdio.h>
#include<stdbool.h>
#define MAX 1000100
 
int main(void){
    bool prime[MAX];
    int i,j,n,count;
    for(i=0;i<MAX;i++){
        prime[i]=1;
    }
    prime[0]=prime[1]=0;
     
    for(i=2;i<MAX;i++){
        for(j=2;i*j<MAX;j++){
            prime[i*j]=0;
        }
    }
 
    while((scanf("%d",&n))!=EOF){
        count=0; 
        for(i=0;i<n+1;i++){
            if(prime[i]==1){
                count++;
            }
        }
        printf("%d\n",count);
    }
    return 0;
}
  

Measured memory_bytes: 1568
def add_num(cur,fut):
  for x in fut:
    ne = cur + str(x)
    rep = fut[:]
    rep.remove(x)
    
    if len(rep) > 0:
      add_num(ne,rep)
    else:
      p_list.append(int(ne))

  
  return p_list

N = int(input().rstrip())
P = list(map(str,input().rstrip().split()))
Q = list(map(str,input().rstrip().split()))

plist = ''
qlist = ''

for p in P:
  plist = plist + p

for q in Q:
  qlist = qlist + q
  
pl = int(plist)
ql = int(qlist)

#大きさNの数列を作る
p_list = []
fut = [i for i in range(1,N+1)]
cur = ''

add_num(cur,fut)

p_list.sort()

#print(p_list)

a = p_list.index(pl)
b = p_list.index(ql)

if a-b < 0:
  print(b-a)
else :
  print(a-b)




Measured memory_bytes: 4720
#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; }

/* attention
    long longのシフト演算には気をつけよう
    タイポした時のデバッグが死ぬほどきつくなるので変数名は最低3字くらい使った方がいいかも
    sizeは(int)とキャストしよう
    cin.tie(0);
    ios::sync_with_stdio(false);<- これら、printfとかと併用しない方が良さそう

*/

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

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 const inf = 1<<29;
int N;
vector<int> A, B;

// 配る bitDP
void solve() {
    vector<vector<int>> dp((1<<N)+1, vector<int>(55, inf));
    dp[0][0] = 0;
    rep(bit, 1<<N) {
        int cnt = __builtin_popcount(bit);

        // bit に含まれない残りの要素が何番目になるか
        vector<pair<int, int>> ords;
        int itr = cnt;
        rep(i, N) if (!(bit&(1<<i))) ords.emplace_back(i, itr++);

        rep(s, 51) {
            if (dp[bit][s] == inf) continue;
            for(auto p: ords) {
                // p.first: 元々の a の index
                // p.second: dp[bit][s] (遷移元)の状態での index
                int ns = -1;
                if (abs(p.first-cnt)%2 == 0) ns = A[p.first];
                else ns = B[p.first];

                if (ns>=s) chmin(dp[bit | 1<<p.first][ns], dp[bit][s] + abs(p.second - cnt));
            }
        }
    }

    int ans = inf;
    rep(s, 51) chmin(ans, dp[(1<<N)-1][s]);
    cout << (ans==inf? -1:ans) << endl;
}

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

    cin >> N;
    A.resize(N), B.resize(N);
    rep(i, N) cin >> A[i];
    rep(i, N) cin >> B[i];
    solve();
    
    return 0;
}


Measured memory_bytes: 67968
package main

import (
    "os"
    "fmt"
    "math"
)

func main() {
    var h, n, d, c int

    fmt.Fscanf(os.Stdin, "%d %d", &h, &n)

    dp := make([]int64, h + 1)
    for i := 0; i < len(dp); i++ {
        dp[i] = int64(math.Pow(10, 18))
    }

    dp[0] = 0

    for i := 0; i < n; i++ {
        fmt.Fscanf(os.Stdin, "%d %d", &d, &c)

        for j := 0; j < h; j++ {
            idx := int(math.Min(float64(h), float64(j + d)))
            dp[idx] = int64(math.Min(float64(dp[j] + int64(c)), float64(dp[idx])))
        }
    }
    fmt.Println(dp[h])
}


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

int main()
{
	auto c = vector<vector<int>>(3, vector<int>(3));
	for(auto&& d : c){
		for(auto&& e : d) cin >> e;
	}
	auto a = vector<int>(3);
	for(auto i = 0; i < 3; ++i){
		a[i] = min({ c[i][0], c[i][1], c[i][2] });
	}
	bool ans = true;
	for(auto j = 0; j < 3; ++j){
		int b = c[0][j] - a[0];
		for(auto i = 1; i < 3; ++i){
			if(a[i] + b != c[i][j]){
				ans = false;
				break;
			}
		}
		if(!ans) break;
	}
	cout << (ans ? "Yes" : "No") << endl;
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	static Scanner sc = new Scanner(System.in);
	static int[] sq = new int[20001];

	public static void main(String[] args) {
		for (int i = 1; i * i < 20000; ++i) {
			sq[i * i] = i;
		}
		int N = sc.nextInt();
		for (int i = 0; i < N; ++i) {
			int m = sc.nextInt();
			int n = sc.nextInt();
			System.out.println(solve(m, n) ? "P" : "C");
		}
	}

	static boolean solve(int M, int N) {
		int D = M * M + N * N;
		for (int i = 2; i * i <= D; ++i) {
			if (D % i != 0) continue;
			for (int p = 1; p * p <= i; ++p) {
				int q = sq[i - p * p];
				if (p * p != i && q == 0) continue;
				if ((M * p + N * q) % i == 0 && (M * q - N * p) % i == 0) return false;
			}
		}
		return true;
	}
}

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

class Apple
{
    public int num { get; set; }
    public int score { get; set; }
}


class Program
{
    static void Main(string[] args)
    {
        var Apples = new List<Apple>();

        // スペース区切りの整数の入力
        string[] input = Console.ReadLine().Split(' ');
        int N = int.Parse(input[0]);
        int L = int.Parse(input[1]);

        for (int i = 0; i < N; i++)
        {
            var ap = new Apple();

            ap.num = i;
            ap.score = i + L;
            Apples.Add(ap);
        }

        var min = Apples.Min(w => (Math.Abs(w.score)));
        Apples.Remove(Apples.Where(w => Math.Abs(w.score) == min).First());
        int sum = Apples.Sum(s => s.score);

        //出力
        Console.WriteLine(sum);
    }
}

Measured memory_bytes: 13396
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
 
#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
 
using namespace std;
using namespace __gnu_pbds;
 
typedef long long ll;
typedef long double ld;
typedef complex<ld> cd;
 
typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;
 
typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<cd> vcd;
 
template <class T> using Tree = tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>;
 
#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)
 
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
 
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
 
const int MOD = 1000000007;
const ll INF = 1e18;
const int MX = 100001; //check the limits, dummy
 
int main() {
	ios_base::sync_with_stdio(0); cin.tie(0);    
	
    ll A, B; cin >> A >> B;
    cout << (A*B)/__gcd(A, B) << endl;
	
	return 0;
}
 
// read the question correctly (ll vs int)
// template by bqi343



Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
import java.util.Arrays;
import java.util.Objects;

public class Main{
    public static void main(String[] args){
        FastScanner sc = new FastScanner();

        int n = sc.nextInt();
        int m = sc.nextInt();
        int[][] a = new int[n][m];
        int[] b = new int[m];

        for(int i=0;i<n;i++){
            for(int j=0;j<m;j++)a[i][j] = sc.nextInt();
        }
        for(int i=0;i<m;i++)b[i] = sc.nextInt();

        for(int i=0;i<n;i++){
            int tmp = 0;
            for(int j=0;j<m;j++){
                tmp += a[i][j]*b[j];
            }
            System.out.println(tmp);
        }
    }

    public static class FastScanner {
        BufferedReader br;
        StringTokenizer st;

        public FastScanner(String s) {
            try {
                br = new BufferedReader(new FileReader(s));
            } catch (FileNotFoundException e) {
                e.printStackTrace();
            }
        }

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

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

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

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

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



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

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

Measured memory_bytes: 1156
#include<iostream>
#include<cmath>
#include<vector>
#include<set>
#include<algorithm>
#include<tuple>
#include<utility>
#include<cctype>
#include <climits>
using namespace std;

#define REP(i,n) for(int i=0;i<n;++i)
#define RUP(a,b) ((a+b-1)/(b))
#define enter "\n"

typedef long long ll;
typedef tuple<int,int,bool> Tb;

int atcoder(){
    ll n,m;
    cin >> n >> m;
    ll ans;
    
    if(n==1 && m==1) ans = 1;
    else if(n==1) ans = m-2;
    else if(m==1) ans = n-2;
    else ans = (n-2)*(m-2);
    
    cout << ans <<endl;
    return 0;
}

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


Measured memory_bytes: 256
#include<stdio.h>

int N = 100;

int min(int x, int y){
  
  if(x < y)  return x;

  
  if (x > y)  return y;
    
}


int main(){

  int i, j, k, l,num, p[N+1], m[N+1][N+1];

  scanf("%d", &num);

  for ( i = 1; i <= num; i++ ){

    scanf("%d %d", &p[i-1], &p[i]);

  }

  for ( i = 1; i <= num; i++ ) m[i][i] = 0;

  for ( l = 2; l <= num; l++ ){

    for ( i = 0; i <= num-l+1; i++ ){

      j = i+l-1;

      m[i][j] = (1<<21);  //200000

      for ( k = i; k <= j-1; k++ ){

        m[i][j] = min(m[i][j], m[i][k] + m[k+1][j] + p[i-1]*p[k]*p[j]);

      }

    }

  }

  printf("%d\n", m[1][num]);


  return 0;

}

Measured memory_bytes: 636
#include <bits/stdc++.h>
using namespace std;
#define start_routine cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(false); int begtime = clock();
#define end_routine int endtime = clock(); cerr << endl << "Time elapsed: " << (endtime - begtime)*1000/CLOCKS_PER_SEC << " ms"; return 0
#define endl '\n'
#define contests_de_diya_kar 0
#define PB push_back
#define MP make_pair
#define int long long
#define MOD ((long long) (1000*1000*1000 + 7))
#define inf (int) 2e15
#define exit(a, b) return cout << a, b;
#define eps (double)1e-8
#define forn(a, b, i) for (int i = a; i < b; i += 1)
#define vi vector<int>
#define vb vector<bool>
#define all(v) v.begin(), v.end() 
#define pii pair<int, int>
#define mii map<int, int> 
#define print(stuff) cout << stuff << endl
#define len(stuff) stuff.size()

vector<pair<int, int>> tree;
vector<int> arr;
pair<int, int> qans(MP(-inf, -inf));

void build (int l, int r, int node) {
	if (l == r) {
		tree[node].first = arr[l];
		tree[node].second = -inf;
		return;
	} 
	int mid = (l + r) / 2;
	build(l, mid, 2 * node + 1);
	build(mid + 1, r, 2 * node + 2);
	vi te;
	te.push_back(tree[2 * node + 1].first);
	te.push_back(tree[2 * node + 2].first);
	te.push_back(tree[2 * node + 1].second);
	te.push_back(tree[2 * node + 2].second);

	sort(all(te));
	reverse(all(te));
	tree[node].first = te[0];
	tree[node].second = te[1];
}

void update (int l, int r, int node, int idx, int x) {
	if (l > idx or r < idx) return;
	if (l == r) {
		tree[node].first = x;
		tree[node].second = -inf;
		return;
	}
	int mid = (l + r) / 2;
	update (l, mid, 2 * node + 1, idx, x);
	update (mid + 1, r, 2 * node + 2, idx, x);
	vi te;
	te.push_back(tree[2 * node + 1].first);
	te.push_back(tree[2 * node + 2].first);
	te.push_back(tree[2 * node + 1].second);
	te.push_back(tree[2 * node + 2].second);

	sort(all(te));
	reverse(all(te));
	tree[node].first = te[0];
	tree[node].second = te[1];
}

void query (int l, int r, int node, int lu, int ru) {
	if (l > lu or r < lu) return;
	if (l >= lu and r <= ru) {
		vi te;
		te.push_back(qans.first);
		te.push_back(qans.second);
		te.push_back(tree[node].first);
		te.push_back(tree[node].second);

		sort(all(te));
		reverse(all(te));
		qans.first = te[0], qans.second = te[1];
		return;
	}
	int mid = (l + r) / 2;
	query (l, mid, 2 * node + 1, lu, ru);
	query (mid + 1, r, 2 * node + 2, lu, ru);
}
signed main () {
	start_routine;
	#ifndef ONLINE_JUDGE
	//freopen("input.txt", "r", stdin);
	#endif

	int n, k;
	cin >> n >> k;

	if (n % k == 0) cout << 0 << endl;
	else cout << 1 << endl;

	end_routine;
}


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

int main(){
	string S;
	int count = 0;
	
	cin>>S;
	
	for(int i = 0; i < S.size(); i++){
		if(S[i]-'A' - count%26 <= 0) count+=26;
		count += (S[i]-'A')-count%26;
	}
	
	cout<<count/26<<endl;
	
	return 0;
}


Measured memory_bytes: 3204
from collections import defaultdict
from collections import deque
from string import ascii_uppercase
import sys, bisect, math, heapq

stdin = sys.stdin
read_int = lambda : list(map(int,stdin.readline().split()))
read_str = lambda : stdin.readline().rstrip()

a, b, c = read_int()

def solve():
    if (a == b == c) or (a != b and b != c and c != a):
        return "No"
    return "Yes"

if __name__ == "__main__":
    print(solve())

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

int main() {
  int N;
  cin>>N;
  
  vector<int> vec(N);
  for(int i=0;i<N;i++){
    cin>>vec.at(i);
  }
  
  sort(vec.begin(),vec.end());
  
  for(int i=0;i<N-1;i++){
    if(vec.at(i)==vec.at(i+1)){
      cout<<"NO"<<endl;
      return 0;
    }
  }
  cout<<"YES"<<endl;
    
    
  
 
  
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define REP2(i, x, n) for(int i = x; i < (int)(n); i++)
#define ALL(n) begin(n), end(n)
//struct cww{cww(){ios::sync_with_stdio(false);cin.tie(nullptr);}}star;
const long long INF = numeric_limits<long long>::max();

int main() {
  int n, k;
  scanf("%d", &n);
  scanf("%d", &k);

  vector<int> arr(n);
  REP(i, n) {
    scanf("%d", &arr[i]);
  }
  // 幅kの総和が最も大きいインデックスを探す
  int val = 0;
  int m_val = 0;
  int m_idx = 0;

  REP(i, n) {
    val += arr[i];
    if (i + 1 < k) {
      continue;
    }
    if (i >= k) {
      val -= arr[i - k];
    }
    if (val > m_val) {
      m_val = val;
    }
  }

  double e = (m_val + k) / 2.0;

  printf("%.16lf\n", e);

  return 0;
}


Measured memory_bytes: 1024