akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <functional>
#include <limits>
#include <queue>
#include <iomanip>
#include <deque>
#include <stack>
#include <cstdio>
#include <cmath>
#include <complex.h>
#include <cstdio>
#include <random>
#include <chrono>
#include <numeric>
#include <cassert>
#include <iso646.h>
#include <exception>
#include <stdexcept>

using namespace std;

typedef long long i64;

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

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

    int dp[11][2] = {};

    dp[0][0] = 1;
    dp[0][1] = 1;

    for (int i = 1; i <= n; i++)
    {
        dp[i][0] = min(2 * dp[i - 1][0], 2 * dp[i - 1][1]);
        dp[i][1] = min(dp[i - 1][0] + k, dp[i - 1][1] + k);
    }

    cout << min(dp[n][0], dp[n][1]);
}

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

using ll = long long;

const int INF = 1001001001;
const ll INF_LL = 1001001001001001001LL;

int main(void){
  char c; cin >> c;
  c+=1;
  cout << c << endl;
  
  return 0;
}


Measured memory_bytes: 3632
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main(){
   ll k;
   cin>>k;
  
   queue<string> q;
   string ans;
   for(int i = 1; i <= min(9ll,k);i++){
        string x(1,'0');
        x[0] = i+'0';
        q.push(x);
   }
   for(int i=1;i<=k;i++){
         string curr = q.front();
         ans = curr;

         q.pop();
        
         int len = curr.size();
         int x = curr[len-1]-'0';
         int prev = (x-1);
         int nxt = (x+1);
         if(x!=0){
             curr = curr + (char)(prev+'0');
             q.push(curr);
             curr.pop_back();
         }
            curr = curr + (char)(x+'0');
            q.push(curr);
            curr.pop_back();
         
         if(x!=9){
            curr = curr + (char)(nxt + '0');
            q.push(curr);
            curr.pop_back();
         }
   }

   cout<<ans<<endl;

}


Measured memory_bytes: 13824
#include<stdio.h>
int main(){
  
  int arr[100],N,i,j,temp=0,count=0;
  
  scanf("%d",&N);
  for(i=0;i<N;i++) scanf("%d",&arr[i]);
  
  for(i=0;i<N;i++){
    for(j=N-1;j>i;j--){
      if(arr[j]<arr[j-1]) {
	temp=arr[j];
	arr[j]=arr[j-1];
	arr[j-1]=temp;
	count++;
      }
    }
  }
  for(i=0;i<N;i++){
    printf("%d",arr[i]);
    if(i!=N-1) printf(" ");
  }
  printf("\n%d\n",count);
  return 0;
}

Measured memory_bytes: 604
import java.util.*;import java.io.*;import java.math.*;
public class Main
{
    public static void process()throws IOException
    {
        long a=nl();
        long b=nl();
        long n=nl();
        long ans=((n+1)/b)*b-1;
        if(ans==-1)
            ans=n;
        // pn(ans);
        long act=((a*ans)/b)-(a*(ans/b));
        pn(act);
    }

    static AnotherReader sc;
    static PrintWriter out;
    public static void main(String[]args)throws IOException
    {
        boolean oj = true;
        if(oj){sc=new AnotherReader();out=new PrintWriter(System.out);}
        else{sc=new AnotherReader(100);out=new PrintWriter("output.txt");}
        int t=1;
        // t=ni();
        while(t-->0) {process();}
        out.flush();out.close();  
    }

    static void pn(Object o){out.println(o);}
    static void p(Object o){out.print(o);}
    static void pni(Object o){out.println(o);out.flush();}
    static int ni()throws IOException{return sc.nextInt();}
    static long nl()throws IOException{return sc.nextLong();}
    static double nd()throws IOException{return sc.nextDouble();}
    static String nln()throws IOException{return sc.nextLine();}
    static int[] nai(int N)throws IOException{int[]A=new int[N];for(int i=0;i!=N;i++){A[i]=ni();}return A;}
    static long[] nal(int N)throws IOException{long[]A=new long[N];for(int i=0;i!=N;i++){A[i]=nl();}return A;}
    static long gcd(long a, long b)throws IOException{return (b==0)?a:gcd(b,a%b);}
    static int gcd(int a, int b)throws IOException{return (b==0)?a:gcd(b,a%b);}
    static int bit(long n)throws IOException{return (n==0)?0:(1+bit(n&(n-1)));}

/////////////////////////////////////////////////////////////////////////////////////////////////////////

    static class AnotherReader{BufferedReader br; StringTokenizer st;
    AnotherReader()throws FileNotFoundException{
    br=new BufferedReader(new InputStreamReader(System.in));}
    AnotherReader(int a)throws FileNotFoundException{
    br = new BufferedReader(new FileReader("input.txt"));}
    String next()throws IOException{
    while (st == null || !st.hasMoreElements()) {try{
    st = new StringTokenizer(br.readLine());}
    catch (IOException  e){ e.printStackTrace(); }}
    return st.nextToken(); } int nextInt() throws IOException{
    return Integer.parseInt(next());}
    long nextLong() throws IOException
    {return Long.parseLong(next());}
    double nextDouble()throws IOException { return Double.parseDouble(next()); }
    String nextLine() throws IOException{ String str = ""; try{
    str = br.readLine();} catch (IOException e){
    e.printStackTrace();} return str;}}
   
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
}

Measured memory_bytes: 32768
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(ll i = 0; i < (n); ++i)
#define repA(i, a, n) for(ll i = a; i < (n); ++i)
#define repD(i, a, n) for(ll i = a; i > (n); --i)
#define trav(a, x) for(auto& a : x)
#define all(x) x.begin(), x.end()
#define sz(x) (long long) (x).size()
#define fill(a) memset(a, 0, sizeof(a))
#define fst first
#define snd second
// #define mp make_pair
#define pb push_back
void __print(int x) {cout << x;}
void __print(long x) {cout << x;}
void __print(long long x) {cout << x;}
void __print(unsigned x) {cout << x;}
void __print(unsigned long x) {cout << x;}
void __print(unsigned long long x) {cout << x;}
void __print(float x) {cout << x;}
void __print(double x) {cout << x;}
void __print(long double x) {cout << x;}
void __print(char x) {cout << '\'' << x << '\'';}
void __print(const char *x) {cout << '\"' << x << '\"';}
void __print(const string &x) {cout << '\"' << x << '\"';}
void __print(bool x) {cout << (x ? "true" : "false");}
template<typename T, typename V>
void __print(const pair<T, V> &x) {cout << '{'; __print(x.first); cout << ','; __print(x.second); cout << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cout << '{'; for (auto &i: x) cout << (f++ ? "," : ""), __print(i); cout << "}";}
void _print() {cout << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cout << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define dbg(x...) cout << "[" << #x << "] = ["; _print(x)
#else
#define dbg(x...)
#endif
const long double PI = 3.141592653589793238462643383;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<long long int> vll;
typedef vector<double> vd;
typedef vector<pii> vii;
long long Ceil(long long a, long long b){
    if(a%b==0) return a/b;
    else return (a/b)+1;
}
ll p=1000000007;
float E = 0.00000000000001;
ll power(ll x, ll y){
    if(y==0){
        return 1;
    }
    if(y%2==0){
        ll q=power(x,y/2);
        q=q%p;
        return (q*q)%p;
    }
    ll q=power(x,y/2);
    q=q%p;
    return ((x%p)*((q*q)%p))%p; 
}
bool isPowerOfTwo (long long x)  
{  
    /* First x in the below expression is for the case when x is 0 */
    return x && (!(x&(x-1)));  
}  

long long int gcd(long long int a, long long int b){ 
    if (a == 0) 
        return b;  
    return gcd(b % a, a); 
}
long long int mod(long long int a, long long int b) {
    long long int ret = a%b; return ret>=0? ret: ret+b; 
}
int main(){
    std::ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);   
    freopen("output.txt", "w", stdout);
    #endif
    int t = 1;
    // cin>>t;
    while(t--){ 
        int n,x,time;
        cin>>n>>x>>time;
        cout<<Ceil(n,x)*time;
    }
    return 0;
}


Measured memory_bytes: 3636
use std::io::*;
use std::str::FromStr;

pub fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main() {
    let n: usize = read();
    let m: usize = read();
    println!("{}", (n - 1) * (m - 1));
}


Measured memory_bytes: 4352
n = int(input())
a = list(map(int, input().split()))
x = a[0]
y = sum(a[1:])
mina = abs(x - y)
for i in range(1, n - 1):
    x += a[i]
    y -= a[i]
    mina = min(mina, abs(x - y))
print(mina)

Measured memory_bytes: 24948
(N, K), *XYCs = readlines.map{|l| l.split.map(&:to_i)}

def cnt?(x, y, t)
  XYCs.count{|x1, y1, c| Math.hypot(x1 - x, y1 - y)*c <= t + 1e-9} >= K
end

def ok?(t)
  return true if XYCs.any?{|x, y, _| cnt?(x, y, t)}
  XYCs.combination(2) do |(x1, y1, c1), (x2, y2, c2)|
    r1, r2 = t/c1, t/c2
    d = Math.hypot(x1 - x2, y1 - y2)
    next if r1 + r2 < d || d < (r1 - r2).abs
    s = Math.atan2(y2 - y1, x2 - x1)
    tmp = (r1*r1 + d*d - r2*r2)/(2*r1*d)
    next unless -1 <= tmp && tmp <= 1
    q = Math.acos((r1*r1 + d*d - r2*r2)/(2*r1*d))
    return true if cnt?(x1 + r1*Math.cos(s + q), y1 + r1*Math.sin(s + q), t)
    return true if cnt?(x1 + r1*Math.cos(s - q), y1 + r1*Math.sin(s - q), t)
  end
  false
end

puts (0.0 .. 1e9).bsearch{|t| ok?(t)}

Measured memory_bytes: 1916
#include <cstdio>
const int maxn=10010;
int n;
int main()
{
    //freopen("1.txt","r",stdin);
    while (scanf("%d",&n)!=EOF)
    {
        int t,ans=0;
        for (int i=0;i<n;i++)
        {
            scanf("%d",&t);
            while (t%2==0)
            {
                ans++;
                t/=2;
            }
        }
        printf("%d\n",ans);
    }
    return 0;
}


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

namespace AtCoder
{

    static class Program
    {
        static void Main()
        {
            var ans = (GetIntArray().Distinct().Count() == 2).YesNo();


            Console.WriteLine(ans);
            Console.ReadKey();
        }

        static void Solve()
        {

        }



        static public string GetStr() { return Console.ReadLine().Trim(); }
        static public int GetInt() { return int.Parse(Console.ReadLine()); }
        static public long GetLong() { return long.Parse(Console.ReadLine()); }
        static public string[] GetStrArray() { return Console.ReadLine().Split(' '); }
        static public int[] GetIntArray() { return Console.ReadLine().Split(' ').Select(int.Parse).ToArray(); }
        static public long[] GetLongArray() { return Console.ReadLine().Split(' ').Select(long.Parse).ToArray(); }
        static public char[] GetCharArray() { return Console.ReadLine().Split(' ').Select(char.Parse).ToArray(); }
        static public List<double> GetDoubleList() { return Console.ReadLine().Split(' ').Select(double.Parse).ToList(); }
        static public void WriteObjects<T>(IEnumerable<T> values) { foreach (var o in values) { Console.Write(o + " "); } }
        static string yesno(this bool b) { return b ? "yes" : "no"; }
        static string YesNo(this bool b) { return b ? "Yes" : "No"; }
        static string YESNO(this bool b) { return b ? "YES" : "NO"; }

        static bool eq<T, U>() => typeof(T).Equals(typeof(U));
        static T ct<T, U>(U a) => (T)Convert.ChangeType(a, typeof(T));
        static T cv<T>(string s) => eq<T, int>() ? ct<T, int>(int.Parse(s))
                           : eq<T, long>() ? ct<T, long>(long.Parse(s))
                           : eq<T, double>() ? ct<T, double>(double.Parse(s))
                           : eq<T, char>() ? ct<T, char>(s[0])
                                             : ct<T, string>(s);
        static void Multi<T>(out T a) => a = cv<T>(GetStr());
        static void Multi<T, U>(out T a, out U b)
        {
            var ar = GetStrArray(); a = cv<T>(ar[0]); b = cv<U>(ar[1]);
        }
        static void Multi<T, U, V>(out T a, out U b, out V c)
        {
            var ar = GetStrArray(); a = cv<T>(ar[0]); b = cv<U>(ar[1]); c = cv<V>(ar[2]);
        }
        static void Multi<T, U, V>(out T a, out U b, out V c, out V d)
        {
            var ar = GetStrArray(); a = cv<T>(ar[0]); b = cv<U>(ar[1]); c = cv<V>(ar[2]); d = cv<V>(ar[3]);
        }
    }
}

Measured memory_bytes: 13396
x_1,y_1,x_2,y_2 = gets.split.map(&:to_i)
x_2 = x_2 - x_1
y_2 = y_2 - y_1
x_4 = -y_2
y_4 = x_2
x_3 = x_4 + x_2
y_3 = y_4 + y_2

x_3 += x_1
y_3 += y_1
x_4 += x_1
y_4 += y_1

puts [x_3,y_3,x_4,y_4].join(' ')

Measured memory_bytes: 1788
<?php
fscanf(STDIN,"%d %d",$n,$k);

$rireki = array();


$n = $n%$k;


while(true){
    if(in_array(abs($n-$k),$rireki)){
        break;
    }else{
        $n = abs($n-$k);

    }
    $rireki[] = $n;
}


echo min($rireki)."\n";


Measured memory_bytes: 4728
#include <stdio.h>
#include <string.h>
#define ll long long
#define rep(i,l,r)for(ll i=(l);i<(r);i++)
#define repp(i,l,r,k)for(ll i=(l);i<(r);i+=(k))
#define INF ((1LL<<62)-(1LL<<31))
#define max(p,q)((p)>(q)?(p):(q))
#define min(p,q)((p)<(q)?(p):(q))
#define bit(n,m)((n>>m)&1)
int upll(const void*a, const void*b){return*(ll*)a<*(ll*)b?-1:*(ll*)a>*(ll*)b?1:0;}
int downll(const void*a, const void*b){return*(ll*)a<*(ll*)b?1:*(ll*)a>*(ll*)b?-1:0;}
void sortup(ll*a,int n){qsort(a,n,sizeof(ll),upll);}
void sortdown(ll*a,int n){qsort(a,n,sizeof(ll),downll);}

char s[10][10];
ll dir[9]={0,1,1,-1,0,-1,-1,1,0};

ll f(char c){
	char cc='x'^'o'^c;
	ll a[10][10]={};
	ll M=0;
	rep(i,0,8)rep(j,0,8)if(s[i][j]=='.'){
		ll cnt=0;
		rep(k,0,8){
			ll ci=i+dir[k],cj=j+dir[k+1],ccnt=0;
			while(1){
				if(!(0<=ci&&ci<8&&0<=cj&&cj<8)||s[ci][cj]=='.'){
					ccnt=0;
					break;
				}
				if(s[ci][cj]==c)break;
				if(s[ci][cj]==cc){
					ccnt++;
					ci+=dir[k];
					cj+=dir[k+1];
				}
			}
			cnt+=ccnt;
		}
		a[i][j]=cnt;
		M=max(M,cnt);
	}
	
	if(M==0)return 0;
	
	ll Mi,Mj;
	if(c=='o'){
		rep(i,0,8)rep(j,0,8)if(a[i][j]==M){
			Mi=i;
			Mj=j;
			i=j=8;
		}
	}else{
		for(ll i=7;i>=0;i--)for(ll j=7;j>=0;j--)if(a[i][j]==M){
			Mi=i;
			Mj=j;
			i=j=-1;
		}
	}
		
	s[Mi][Mj]=c;
	rep(k,0,8){
		ll ci=Mi+dir[k],cj=Mj+dir[k+1],ccnt=0;
		while(0<=ci&&ci<8&&0<=cj&&cj<8&&s[ci][cj]==cc){
			ci+=dir[k];
			cj+=dir[k+1];
		}
		if(0<=ci&&ci<8&&0<=cj&&cj<8&&s[ci][cj]==c){
			while(ci!=Mi||cj!=Mj){
				ci-=dir[k];
				cj-=dir[k+1];
				s[ci][cj]=c;
			}
		}
	}
	return M;
}


int main(){
	rep(i,0,8)scanf("%s",s[i]);
	ll flag=1;
	while(flag){
		flag=0;
		flag|=f('o');
//		rep(i,0,8)puts(s[i]);puts("");
		flag|=f('x');
//		rep(i,0,8)puts(s[i]);puts("");
	}
	rep(i,0,8)puts(s[i]);
	return 0;
}


Measured memory_bytes: 2104
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {
    public static void main(String[] args) throws Exception {
        // Here your code !
        BufferedReader br = new BufferedReader(new
InputStreamReader(System.in));
        String[] lineArray = br.readLine().split(" ", 0);
        long d = Long.parseLong(lineArray[0]);
        long a = Long.parseLong(lineArray[1]);
        long b = Long.parseLong(lineArray[2]);
        if (b <= a) {
            System.out.println("delicious");
        } else if (b <= a + d) {
            System.out.println("safe");
        } else if (b > a + d) {
            System.out.println("dangerous");
        }
    }
}

Measured memory_bytes: 23380
n=int(input())
a_l = list(map(int,input().split()))
b_l = list(map(int,input().split()))
c_l = list(map(int,input().split()))

score=0
for i in range(n):
  score+=b_l[a_l[i]-1]
  if(i>0):
    if(a_l[i]-a_l[i-1]==1):
      score+=c_l[a_l[i-1]-1]  
   
print(score)

Measured memory_bytes: 3064
s = input()[::-1]
l = [0 for i in range(2019)]
l[0] = 1
a, b = 0, 1
ans = 0
for i in s:
    a += int(i) * b
    a %= 2019
    b *= 10
    b %= 2019
    l[a] += 1
for i in l:
    ans += i * (i - 1) // 2
print(ans)

Measured memory_bytes: 9376
#include<stdio.h>
#define MAX 100005
#define NIL -1
struct Node_struct{int p, l, r;};
/*p: 親(parent), l: 一番左の子(left child), r:右の兄弟(right sibling)*/
typedef struct Node_struct Node;
Node T[MAX];
int D[MAX];

void print(int u){
  int i, c;
  printf("node %d: parent = %d, depth = %d, ", u, T[u].p, D[u]);

  if(D[u]==0) printf("root, ");
  else if(T[u].l==NIL) printf("leaf, ");
  else printf("internal node, ");

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

}

void calcDepth(int u, int p){
  D[u] = p;
  if(T[u].r!=NIL) calcDepth(T[u].r,p);
  if(T[u].l!=NIL) calcDepth(T[u].l,p+1);
}

int main(){
  int i, j, k;
  int n;
  int id, sib, child;
  int root = NIL;
  scanf("%d", &n);
  for(i=0; i<n; i++) T[i].p = T[i].l = T[i].r = NIL;

  for(i=0; i<n; i++){
    scanf("%d %d", &id, &k);
    for(j = 0, sib = NIL; j<k; j++){ //子を入力する (input children)
      scanf("%d", &child);
      T[child].p = id;
      if(j == 0) T[id].l = child; //idの一番左の子 (the most left child of id)
      else T[sib].r = child; //左の兄弟に繋げる (connect to left sibling)
      sib = child;//次の子供の左の兄弟 (the left sibling of the next child)
    }
  }

  //根を求める (find the root)
  for(i=0; i<n; i++){
    if(T[i].p == -1) root = i;
  }

  //それぞれのノードの深さを求める (find depth of each node)
  calcDepth(root, 0);

  //出力 (output)
  for(i=0; i<n; i++) print(i);

  return 0;
}



Measured memory_bytes: 6408
n = gets.chomp.to_i
a = gets.chomp.split.map(&:to_i)
b = []
c = 1
for x in 0..n - 1
  b << a[x].abs
  if a[x] != a[x].abs
    c = c * -1
  end
end
if c < 0
  puts b.inject(:+) - b.min * 2
else
  puts b.inject(:+)
end


Measured memory_bytes: 10628
#include <cstdio>
#include <cmath>
#include <cstring>
#include <iostream>
#include <iomanip>
#include <sstream>
#include <map>
#include <set>
#include <array>
#include <queue>
#include <string>
#include <vector>
#include <numeric>
#include <algorithm>
#include <functional>
#define MOD 1000000007
#define INF 11234567890
#define in std::cin
#define out std::cout
#define rep(i,N) for(LL i=0;i<N;++i)
typedef long long int LL;
typedef std::pair<int, int> P;

int A, B;

int main()
{
	in >> A >> B;
	A = (A == 1 ? 114514 : A);
	B = (B == 1 ? 114514 : B);

	if (A > B) { out << "Alice" << std::endl; }
	else if (B > A) { out << "Bob" << std::endl; }
	else { out << "Draw" << std::endl; }
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

static const int N = 1000;

void trace(int A[], int n){
  int i;
  for ( i = 1; i <= n; i++ ){
    if ( i > 1 ) printf(" ");
    printf("%d", A[i-1]);
  }
  printf("\n");
}

int main(){
  int n, i, j,v;
  int A[N+1];
  scanf("%d", &n);

  for ( i = 0; i < n; i++ ) scanf("%d", &A[i]);
  

  for( i=1;i<n;i++){
     trace(A,n);
    v=A[i];
    j=i-1;
     
    while(j>=0 && A[j]>v){
      
    A[j+1]=A[j];
    j--;
    A[j+1]=v;
  }

  }
  trace(A,n);
  
     return 0;
}

Measured memory_bytes: 604
a = gets.split(" ").map(&:to_i)
a += gets.split(" ").map(&:to_i)
a += gets.split(" ").map(&:to_i)
n = gets.to_i
n.times do
  o = a.index(gets.to_i)
  a[o] = 0 if o
end

if a[0..2] == [0,0,0]
  print("Yes")
elsif a[3..5] == [0,0,0]
  print("Yes")
elsif a[6..8] == [0,0,0]
  print("Yes")
elsif [a[0],a[3],a[6]] == [0,0,0]
  print("Yes")
elsif [a[1],a[4],a[7]] == [0,0,0]
  print("Yes")
elsif [a[2],a[5],a[8]] == [0,0,0]
  print("Yes")
elsif [a[0],a[4],a[8]] == [0,0,0]
  print("Yes")
elsif [a[2],a[4],a[6]] == [0,0,0]
  print("Yes")
else
  print("No")
end

Measured memory_bytes: 1788
#include<iostream>
#include<stack>
#include<string>
#include<queue>
#include<utility>
using namespace std;
int main(){
	int n,m,t,cnt=0,sec=0;
	string s;
	bool flag;
	queue<string> o;
	queue<int> p;
	cin>>n>>m;
	for(int i=0;i<n;++i){
		cin>>s>>t;
		o.push(s),p.push(t);
	}
	flag=true;
	while(flag){
		s=o.front();
		o.pop();
		t=p.front();
		p.pop();
		if(t-m<=0){
			cnt++;
			sec+=t;
			cout<<s<<" "<<sec<<endl;
		}
		else{
			sec+=m;
			t-=m;
		o.push(s);
		p.push(t);
		}
		if(cnt==n)flag=false;
	}
	return 0;
}


Measured memory_bytes: 5684
n, m = map(int, input().split())
A = []
b = []
for i in range(n):
    A.append(list(map(int, input().split())))

for i in range(m):
    b.append(int(input()))

for i in range(n):
    _sum = 0
    for j in range(m):
        _sum += A[i][j] * b[j]
    print(_sum)



Measured memory_bytes: 6008
import java.util.Scanner;
class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n=sc.nextInt();
		int bs[]=new int [n];
		int a=0,b=0,c=0;
		a=sc.nextInt();
		b=sc.nextInt();
		c=sc.nextInt();
		for(int i=0 ; i<n ; i++){
			bs[i]=sc.nextInt();
        }
		for(int i = 0; i<n;i++){
            for(int j=0;j<n;j++){
                if(bs[i]<bs[j]){
                    int work = bs[i];
                    bs[i] = bs[j];
                    bs[j] = work;
                }
            }
        }
		int max=c/a;
		int sum=0;
		for (int i=n-1; i>=0; i--) {
            sum += bs[i];
            max = Math.max(max, (c + sum) / (a + b * (n - i)));
        }
        System.out.println(max);
	}
}

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

int main() {
	int a, b, c, d;
	cin >> a >> b >> c >> d;
	if (abs(a - c) <= d) {
		cout << "Yes" << endl;
	}
	else {
		if (abs(a - b) <= d && abs(b - c) <= d) {
			cout << "Yes" << endl;
		}
		else {
			cout << "No" << endl;
		}
	}
	return 0;
}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<sstream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<climits>
#include<cmath>
#include<string>
#include<vector>
#include<set>
#include<map>
#include<queue>
#include<numeric>
#include<functional>
#include<algorithm>
#include<bitset>
#include<tuple>
#include<unordered_set>
#include<random>
#include<array>
#include<cassert>
using namespace std;
#define INF (1<<29)
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(v) v.begin(),v.end()
#define uniq(v) v.erase(unique(all(v)),v.end())

int n;
tuple<int, int, int> x[100000];

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

	cin >> n;
	rep(i,n) {
		int a, b;
		cin >> a >> b;
		x[i] = make_tuple(a + b, a, b);
	}
	sort(x, x + n);
	reverse(x, x + n);
	long long ans = 0;

	rep(i,n) {
		int s, a, b;
		tie(s, a, b) = x[i];

		if (i % 2 == 0)ans += a;
		else ans -= b;
	}
	cout << ans << endl;



	return 0;
}

Measured memory_bytes: 1408
s = list(input())
s.sort()

t = list(input())
t.sort(reverse=True)

j = 0
for i in s:
    if i < t[j]:
        print('Yes')
        break

    elif i > t[j]:
        print('No')
        break

    else:
        j += 1
        if j == len(t):
            print('No')
            break
        elif j == len(s):
            print('Yes')
            break

Measured memory_bytes: 3064
#include <iostream>
#include <vector>
#include <iomanip>
#include <math.h>
using namespace std;

int main(){
    int N, K;
    cin >> N >> K;
    vector<double> twolist(18, 2);
    for (int i = 2; i < 18;i++)
        twolist[i] = twolist[i - 1] * 2;
    twolist[0] = 1;
    double ans = 0;
    int ind = 0;
    for (int i = N; i >= 1;i--){
        double t = (double)K / i;
        while(twolist[ind] < t)
            ind++;
        ans += (double)1.0 / N * pow(0.5, ind);
    }
    cout << fixed << setprecision(15);
    cout << ans << endl;
    return 0;
}


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

using namespace std ;

const int MAX = 2e5 + 10 ;

long long A[MAX] , B[MAX] ;
int n ;

int main()
{
	ios_base::sync_with_stdio(0) ;
	cin.tie(0) ;
	cin>>n ;
	long long sum1 = 0 , sum2 = 0 , sum = 0 ;
	for(int i = 0 ; i < n ; ++i)
	{
		cin>>A[i]>>B[i] ;
		if(A[i] > B[i])
			sum1 += A[i] - B[i] ;
		if(A[i] < B[i])
			sum2 += B[i] - A[i] ; 
		sum += A[i] ;
	}
	long long ans = 0ll ;
	if(sum1 == 0 && sum2 == 0)
		return cout<<0<<"\n" , 0 ;
	if(sum2 > sum1)
		return cout<<sum<<"\n" , 0 ;
	for(int i = 0 ; i < n ; ++i)
	{
		if(A[i] > B[i])
			ans = max(ans , sum - B[i]) ;
	}
	return cout<<ans<<"\n" , 0 ;
}		

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

int main() {
  int N;
  cin >> N;
  
  if ( N % 10 == 7 ){
    cout << "Yes" << endl;
  }
  else if ( N % 100 / 10 == 7 ){
    cout << "Yes" << endl;
  }
  else if ( N / 10 == 7 ){
     cout << "Yes" << endl;
  }
  else if ( N / 100 == 7 ){
     cout << "Yes" << endl;
  }
  else if ( N / 7 == 1 ){
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }
}

Measured memory_bytes: 3620
#include <bits/stdc++.h>
#define FOR(i, begin, end) for(int i=(begin);i<(end);i++)
#define REP(i, n) FOR(i,0,n)
#define int long long
using namespace std;

typedef pair<int, int> Pii;

void readint(int N, vector<int> &a);
void readdouble(int N, vector<double> &a);
void readindex(int N, vector<int> &a);



signed main(){

    string S;
    cin >> S;

    int ans = 700;
    REP(i, 3){
        if(S[i] == 'o') ans += 100;
    }

    cout << ans;
    
    return 0;
}








void readint(int N, vector<int> &a){
    string s;
    for(int i = 0; i < N - 1; i++){
        getline(cin, s, ' ');
        a[i] = atoi(s.c_str());
    }
    getline(cin, s, '\n');
    a[N - 1] = atoi(s.c_str());
}
void readdouble(int N, vector<double> &a){
    string s;
    for(int i = 0; i < N - 1; i++){
        getline(cin, s, ' ');
        a[i] = atof(s.c_str());
    }
    getline(cin, s, '\n');
    a[N - 1] = atof(s.c_str());
}
void readindex(int N, vector<int> &a){
    string s;
    for(int i = 0; i < N - 1; i++){
        getline(cin, s, ' ');
        a[i] = atoi(s.c_str()) - 1;
    }
    getline(cin, s, '\n');
    a[N - 1] = atoi(s.c_str()) - 1;
}

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

int main(){
	long t;
	
	int h, m;
	
	cin >> t;
	
	h = t/3600;
	
	t -= h*3600;
	m = t/60;
	t -= m*60;
	
	
	cout << h << ":" << m << ":" << t << endl;
}



Measured memory_bytes: 3108
#include <stdio.h>
int main(void)
{
	int a,b,d,r;
	double f;
	scanf("%d %d",&a,&b);
	d=a/b;
	r=a%b;
	f=(double)a/(double)b;
	printf("%d %d %.5f\n",d,r,f);
	return 0;
}


Measured memory_bytes: 2740
#include <iostream>
#include <string>
#include <queue>
#include <vector>
#include <algorithm>
#include <math.h>
#include <map>
#include <iomanip>
#include <queue>


using namespace std;

int main() {
    long long int Q, H, S, D, N, p, P1, P2;
    cin >> Q >> H >> S >> D >> N;
   
    p = min(min(Q * 4, H * 2), S);

    P1 = N * p;
    P2 = N / 2 * D + N % 2 * p;

    cout << min(P1, P2);

    return 0;

}



Measured memory_bytes: 256
#include<iostream>
using namespace std;
 int main(){
     int n,c=0;
     cin>>n;
     int arr[n];
     for(int i=0;i<n;i++){
        cin>>arr[i];
     }
     for(int i=0;i<n;i++){
        for(int j=i+1;j<n;j++){
            c=c+arr[i]*arr[j];
        }
     }
     cout<<c;

 }

Measured memory_bytes: 256
import Control.Applicative

zeros = [1..99]++[101]
ones = map (*100) zeros
twos = map (*100) ones

main = do
    [d,n] <- map read.words <$> getLine :: IO [Int]
    putStrLn.show $ answer d n

answer 0 n = zeros !! (n-1)
answer 1 n = ones !! (n-1)
answer 2 n = twos !! (n-1)

Measured memory_bytes: 508
#include<stdio.h>
int main()
{
    unsigned a,b;
    while(scanf("%u %u",&a,&b)==2)
    {
        if(!(a%3) || !(b%3) || !((a+b)%3))printf("Possible\n");
        else
        {
            printf("Impossible\n");
        }
    }
    return 0;
}


Measured memory_bytes: 128
import java.util.*;

class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();
		for(int i = b; i <= c; i++){
			if(i % a == 0){
				System.out.print("OK");
				return;
			}
		}
		System.out.print("NG");
	}
}

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

#define INF 1000000000

using namespace std;

int main() {
    int n, k, ans = INF;
    cin >> n >> k;
    vector<int> h(n);
    for (int i = 0; i < n; ++i) cin >> h.at(i);
    sort(h.begin(), h.end());
    for (int i = 0; i < n - k + 1; ++i) ans = min(ans, h.at(i + k - 1) - h.at(i));
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 640
import collections
import bisect
import sys
input = sys.stdin.readline
N, M, Q = map(int, input().split())
LR = [tuple(map(int, input().split())) for i in range(M)]
dp = [[0]*(N+1) for i in range(N+1)]

for L, R in LR:
    dp[L][R] += 1
for i in reversed(range(1, N)):
    for j in range(1, N+1):
        dp[i][j] += dp[i+1][j]

for i in range(1, N+1):
    for j in range(1, N+1):
        dp[i][j] += dp[i][j-1]


for _ in range(Q):
    p, q = map(int, input().split())
    print(dp[p][q])


Measured memory_bytes: 83292
#include <iostream>
#include <math.h>
#include <algorithm>
#include <string>
#include <string.h>
using namespace std;

int main() {
	int A,B,K,j=0,ans[200]={};
	cin>>A>>B>>K;
	for(int i=A;i<min(B+1,A+K);i++)
	{
		ans[j]=i;
		j++;
	}
	for(int i=max(B-K+1,A+K);i<B+1;i++)
	{
		ans[j]=i;
		j++;
	}
	for(int i=0;i<j;i++)
	{
		cout<<ans[i]<<endl;
	}
	}

Measured memory_bytes: 256
#include "bits/stdc++.h"
#define ll long long
#define ALL(x) (x.begin(),x.end())
#include<math.h>
#include<vector>
#include<map>
#include<iterator>
#include<string>
using namespace std;

int main ()
{
    int n;
    cin>>n;
    int a[10000];
    for(int i=0;i<n-1;i++)
    {
        cin>>a[i];
    }
    ll sum=0;
    for(int i=1;i<n-1;i++)
    {
        sum+=min(a[i],a[i-1]);
    }
    sum+=a[0]+a[n-2];
    cout<<sum<<endl;
    return 0;
}


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

int C = 0;

int BinarySearch(int x, int S[], int n){
 int B = 0;
 int T = n-1;

 while(B<=T){
  int mid = (B+T)/2;

  if(S[mid]==x){
   C++;
   return mid;
  }else if(S[mid]<x){
   B = mid+1;
  }else{
   T = mid-1;
  }
 }
 
 return -1;
}

int main(){
 int n;
 cin >> n;
 int S[n];
 for(int i=0; i<n; i++){
  cin >> S[i];
 }
 int q;
 cin >> q;
 int T[q];
 for(int i=0; i<q; i++){
  cin >> T[i];
 }

 for(int i=0; i<q; i++){
  BinarySearch(T[i], S, n);
 }

 cout << C << endl;
 
 return 0;
}

Measured memory_bytes: 3652
//A.cpp
#include <iostream>
#include <string>
#include <map>
using namespace std;

int main(){
  int A,B,C;
  cin >> A >> B >> C;
  if(A==B) printf("%d\n",C);
  else if(B==C) printf("%d\n",A);
  else printf("%d\n",B);
  return 0;
}


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

#define swap(type,a,b) {type t; t=a; a=b; b=t;}
#define forN(i,n) for(int i=0;i<n;i++)
#define forS(i,start,n) for(int i=start;i<n;i++)
#define ll long long
#define pb(t,d,n) {t p;int i;forN(i,n){cin>>p;d.push_back(p);}}
#define DOUBLE fixed << setprecision(15)

using namespace std;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<string> vs;
typedef pair<int,int> pii;
typedef vector<pair<int,int>> vpii;

int main(){
    int n,m,cnt=0;
    string s;

    cin >> s;
    int p=0,tmp=0;
    forN(i,s.size()){
        if(s[i]=='1'){
            tmp++;
        }else{
            tmp--;
        }
        if(abs(p)-abs(tmp)>0) cnt++;
        p=tmp;
    }
    cout << cnt*2 << endl;
}


Measured memory_bytes: 3716
def available?(ary, p, k)
  sum = 0
  tracks = 1
  ary.each{ |w|
    if sum + w <= p
      sum += w
    else
      sum = w
      tracks += 1
    end
  }
  tracks <= k
end

def binary(ary, l, r, k)
  if l == r
    return l
  else
    c = ((r - l)/2).to_i + 1 + l
    if available?(ary, c, k)
      binary(ary, l, c-1, k)
    else
      binary(ary, c, r, k)
    end
  end
end

def find_p(ary, k)
  l = ary.max
  r = ary.inject(:+)
  p = binary(ary, l, r, k)
  p += 1 unless available?(ary, p, k)
  p
end

## main
n, k = gets.split(' ').map(&:to_i)
ary = []
(0...n).each { |n|
  ary << gets.to_i
}
puts find_p(ary, k)

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

#define rep(i, n) for(int i = 0, i##_len = (n); i < i##_len; ++i)
#define repp(i, m, n) for(int i = m, i##_len = (n); i < i##_len; ++i)
#define all(x) (x).begin(), (x).end()
#define clr(ar, val) memset(ar, val, sizeof(ar))
template <class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; }
template <class T> bool chmin(T &a, const T &b) { if (b < a) { a = b; return 1; } return 0; }
int gcd(int a,int b){return b?gcd(b,a%b):a;}
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair <int,int> P;
typedef long double ld;

int main(void)
{
	int n, a[300], temae[200001] = {}, muko[200001] = {};
	char s[200001];
	int ans = 200001;
	cin >> n >> s;
	rep(i, n){
		if(s[i] == '#') temae[i + 1]++;
		if(i + 1 < n) temae[i + 2] = temae[i + 1];
	}
	for(int i = n; i > 0; i--){
		if(s[i] == '.') muko[i]++;
		if(i - 1 >= 0) muko[i - 1] = muko[i];
	}
/* 	rep(i, n + 1)cout << temae[i] << " ";cout << endl;
	rep(i, n + 1)cout << muko[i] << " ";cout << endl;
 */	rep(i, n + 1){
		chmin(ans, temae[i] + muko[i]);
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 2048
// Standard I/O
#include <iostream>
#include <sstream>
#include <cstdio>
// Standard Library
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <cmath>
// Template Class
#include <complex>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
// Container Control
#include <algorithm>

using namespace std;

#define rep( i, n ) for( int i = 0; i < n; ++i )
#define irep( i, n ) for( int i = n-1; i >= 0; --i )
#define reep( i, s, n ) for ( int i = s; i < n; ++i )
#define ireep( i, n, s ) for ( int i = n-1; i >= s; --i )
#define foreach(itr, x) for( typeof(x.begin()) itr = x.begin(); itr != x.end(); ++itr)

#define mp make_pair
#define mt make_tuple
#define pb push_back
#define eb emplace_back
#define all( v ) v.begin(), v.end()
#define fs first
#define sc second
#define vc vector

// for visualizer.html
double SCALE = 1.0;
double OFFSET_X = 0.0;
double OFFSET_Y = 0.0;
#define LINE(x,y,a,b) cerr << "line(" << SCALE*(x) + OFFSET_X << ","	\
	<< SCALE*(y) + OFFSET_Y << ","										\
	<< SCALE*(a) + OFFSET_X << ","										\
	<< SCALE*(b) + OFFSET_Y << ")" << endl;
#define CIRCLE(x,y,r) cerr << "circle(" << SCALE*(x) + OFFSET_X << ","	\
	<< SCALE*(y) + OFFSET_Y << ","										\
	<< SCALE*(r) << ")" << endl;

typedef long long ll;
typedef complex<double> Point;

typedef pair<int, int> pii;
typedef pair<int, pii> ipii;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector< vector<int> > vii;
typedef vector< vector<double> > vdd;

typedef vector<int>::iterator vi_itr;

const int IINF = 1 << 28;
const int MOD = 1e9+7;
const double INF = 1e30;
const double EPS = 1e-10;
const double PI = acos(-1.0);

// Direction : L U R D
const int dx[] = { -1, 0, 1, 0};
const int dy[] = { 0, -1, 0, 1 };

int main()
{
    string n;

    int dp[20][10][2] = { 0 };

    cin >> n;

    rep(i, n[0]-'0') dp[0][i][0] = i;
    dp[0][n[0]-'0'][1] = n[0]-'0';

    reep(i, 1, n.size()) {
        rep(j, 10) {
            rep(k, n[i]-'0') dp[i][k][0] = max(dp[i][k][1], dp[i-1][j][1]+k);
            dp[i][n[i]-'0'][1] = max(dp[i][n[i]-'0'][1], dp[i-1][j][1]+(n[i]-'0'));
            rep(k, 10) {
                dp[i][k][0] = max(dp[i][k][0], dp[i-1][j][0]+k);
            }
        }
    }

    int ans = 0;
    rep(i, 10) rep(j, 2) ans = max(ans, dp[n.size()-1][i][j]);
    cout << ans << endl;
}


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

// semi-open   Range minimum query

struct RMQ{
  int n,q,data[(1<<18)];
  RMQ(){
    n=(1<<17);
    int tmp=1;
    while(tmp<n)tmp*=2;
    n=tmp;
    for(int i=0;i<n*2-1;i++)data[i]=INT_MAX;
  }
  void update(int k,int x){
    k+=n-1;
    data[k]=x;
    while(k>0){
      k=(k-1)/2;
      data[k]=min(data[k*2+1],data[k*2+2]);
    }
  }
  int find(int a,int b,int k=0,int l=0,int r=(1<<17)){
    if(r<=a || b<=l)return INT_MAX;
    if(a<=l && r<=b)return data[k];
    int v1=find(a,b,k*2+1,l,(l+r)/2);
    int v2=find(a,b,k*2+2,(l+r)/2,r);
    return min(v1,v2);
  }
};


int main(){
  RMQ a;
  int c,x,y,n,q;
  cin>>n>>q;
  for(int i=0;i<q;i++){
    scanf("%d%d%d",&c,&x,&y);
    if(c)cout<<a.find(x,y+1)<<endl;
    else a.update(x,y);
  }
}


Measured memory_bytes: 4248
#include <iostream>
#include <vector>
using namespace std;
int main() {
int N, x, ans = 0;
cin >> N >> x;
vector<int> a(N);
for (int i = 0; i < N; ++i) cin >> a[i];
sort(a.begin(), a.end());
for (int i = 0; i < N; ++i) {
        x -= a[i];
        if (x < 0) break;
        ans++;
}
if (x > 0) ans--;
cout << ans << endl;
}

Measured memory_bytes: 256
/******************************************************************************

                              Online C++ Compiler.
               Code, Compile, Run and Debug C++ program online.
Write your code in this editor and press "Run" button to compile and execute it.

*******************************************************************************/

#include <bits/stdc++.h>
#define ll long long
#define vr vector<ll>
#define pb push_back

using namespace std;

main ()
{
  int n, count = 0;
  cin >> n;

  while (n--)
    {
      int d1, d2;
      cin >> d1 >> d2;
      if (d1 == d2)
	{
	  count++;
	}
      else if (d1 != d2)
	{
	  if (count >= 3)
	    {
	      break;
	    }
	  else if (count < 3)
	    {
	      count = 0;
	    }
	}

    }
  cout << (count >= 3 ? "Yes" : "No");

  return 0;
}


Measured memory_bytes: 3644
#![allow(unused_mut, unused_macros, unused_variables, unused_assignments, non_snake_case, unused_imports, dead_code)]

use std::cmp::*;
use std::collections::*;

// [Rustで競技プログラミングの入力をスッキリ記述するマクロ - Qiita]
// https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8 から拝借
macro_rules! input {
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};
    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };
    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };
    // ABC128-C-Switches用に拡張
    ($next:expr, [ $t:tt ]) => {{
        let len = read_value!($next, $t);
        (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    }};
    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };
    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };
    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

// Pythonからの移行組としては苦しすぎるのでライブラリ濫造
fn gcd(a:usize, b:usize) -> usize {
    if b == 0 {return a};
    return gcd(b, a % b);
}

// エントリーポイント
fn main() {
    input! {
        N : usize,
        A : [usize; N]
    }
    let mut result = vec![0; N];
    for n in 0..N {
        let i = N - n - 1;
        let mut count = 0;
        let mut ic = i;
        loop {
            ic = (ic + 1) + (i + 1) - 1;
            if N <= ic {
                break;
            }
            count += result[ic];
        }
        if count % 2 != A[i] {
            result[i] = 1;
        }
    }
    let mut result_2 = vec![];
    for n in 0..N {
        if result[n] == 1 {
            result_2.push(n + 1);
        }
    }
    println!("{}", result_2.len());
    if 0 < result_2.len() {
        for r in &result_2 {
            print!("{} ", r);
        }
        println!("");
    }
}


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

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<string> vs;
typedef vector<char> vc;
typedef vector<vc> vvc;
typedef vector<bool> vb;
typedef pair<int, int> pii;
typedef pair<char, char> pcc;

#define ALL(a) (a).begin(),(a).end()
#define ZP(a, len) setfill('0') << setw(len) << right << a
const int INF = 1e9;
const int MOD = 1e9 + 7;
const int dx[4] = {0, 1, 0, -1}, dy[4] = {1, 0, -1, 0};

ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }

ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }


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

    int a, b, c;
    cin >> a >> b >> c;

    auto ans = 2;
    if (a == b && a == c) {
        ans = 1;
    } else if (a != b && a != c && b != c) {
        ans = 3;
    }

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

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

int main() {
    int x,y;
    int a[] ={0,2,0,1,0,1,0,0,1,0,1,0};
    cin >> x >> y;
    if (a[x-1]==a[y-1]){
        printf("Yes");
    }else{
        printf("No");
    }

    return 0;
}

Measured memory_bytes: 256
import std.stdio;
import std.regex;

void main(){
	auto io = new IO();
	auto a = io.line()[0];
	auto b = io.line()[0];
	auto h = io.line()[0];
	
	writeln(((a+b)*h)/2);
}



import std.stdio,std.conv,std.string;
import std.algorithm,std.array,std.math;
import std.bigint;

immutable PRIME = 1_000_000_007;
immutable alphaB = "abcdefghijklmnopqrstuvwxyz";
immutable alphaU = "ABCDRFGHIJKLMNOPQRSTUVWXYZ";

class IO
{
	T[] line( T = real , string token = " " )( size_t m = 1 ){
		T[] arr = [];
		foreach( i ; 0..m ){
			arr ~= this.read!T();
		}
		return arr;
	}
	T[][] rect( T = real , string token = " " )( size_t m = 1 ){
		T[][] arr = new T[][](m);
		foreach( i ; 0..m ){
			arr[i] = this.read!T(token);
		}
		return arr;
	}
	private T[] read( T = size_t )( string token = " " ){
		T[] arr;
		foreach( elm ; readln().chomp().split(token) ){
			arr ~= elm.to!T();
		}
		return arr;
	}
	void swap( T )( ref T x , ref T y ){
		x = x^y;
		y = x^y;
		x = x^y;
	}
}


Measured memory_bytes: 256
//header{{{
#include<bits/stdc++.h>
  
using namespace std;
 
#define rep(i,n) for(int i=0;i<(n);++i)
#define reps(i,n) for(int i=1;i<=(n);++i)
#define all(x) (x).begin(),(x).end()
#define setout(n,x) setw(n+1) << setfill(x)
#define Fixed fixed << setprecision(10)
#define int int64_t
using pii = pair<int,int>;
constexpr int INF  = 0x3f3f3f3f;
constexpr long long LINF = 0x3f3f3f3f3f3f3f3fLL;
constexpr int mod = 1e9+7; 

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

template <class T> using min_heap = priority_queue<T,vector<T>,greater<T> >;
template <class T> using max_heap = priority_queue<T>;
template <class A, class B> using umap = unordered_map<A,B>;
  
int gcd(int a,int b){ return b ? gcd(b,a % b) : a;}
int lcm(int a,int b){ return a / gcd(a,b) * b;}
//}}}

signed main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
    string s,t;
    cin >> s >> t;
    cout << t << s << '\n';
	return 0;
}


Measured memory_bytes: 764
#include<bits/stdc++.h>
using namespace std;
#define fast_input ios_base::sync_with_stdio(false);cin.tie(NULL);
typedef long long int ll;
int main()
{
    fast_input;
    ll n;
    cin>>n;
    if(n%2!=0)
      cout<<0<<endl;
    else{
        ll sum=0;
        ll ans=10,x=1;
        
        while(n){
            sum+=n/10;
            n/=5;
        }
        cout<<sum<<endl;
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define retunr return
#define pb push_back
#define mp make_pair
#define null NULL
#define sc(x) scanf("%d", &x)
#define sc64(x) scanf("%I64d", &x)
#define pr(x) printf("%d", (x))
#define sp putchar(' ')
#define ln putchar('\n')
#define pr64(x) printf("%I64d", (x))
#define rep(i,l,r) for (int i = l, lim = r;i <= lim; ++i)
#define repr(i,l,r) for (int i = r, lim = l;i >= lim; --i)
#define fi first
#define se second
#define SET(__set, val) memset(__set, val, sizeof __set)
#define fill(a,v,n) memset((a),(v),sizeof(a[0])*(n))
#define copy(a,b,n) memcpy((a),(b),sizeof(a[0])*(n))
#define ALL(x) (x.begin(),x.end())
#define prf(x) printf("%.20f", x)
#define for_each_edge(u) for(int i = point[u];i;i=G[i].n)
typedef unsigned int uint;
typedef double db;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

#define N 100010
#define M 1024
#define MOD 1000000007
void _add(int &a, int b){a = (a+b)%MOD;}
void _sub(int &a, int b){a = (a+MOD-b)%MOD;}
void _mul(int &a, int b){a = (ll)a*b%MOD;}
void _max(int &a, int b){a = max(a,b);}
void _min(int &a, int b){a = min(a,b);}
ll gcd(ll a, ll b){if(!b)return a;return gcd(b,a%b);}
ll pw(ll a, ll b){ll res(1);while(b){if(b&1)res=res*a%MOD;a=a*a%MOD;b>>=1;}return res;}
ll pwM(ll a, ll b, ll mod){ll res(1);while(b){if(b&1)res=res*a%mod;a=a*a%mod;b>>=1;}return res;}

const int infi = 2147483647;
const ll infl = 9223372036854775807ll;
const db PI = 3.14159265358979323846;

/*
struct E{
	int v, w, n;
}G[N];
int cnt, point[N];
void adde(int u, int v, int w = 0){
	G[++cnt]=(E){v,w,point[u]},point[u]=cnt;
	G[++cnt]=(E){u,w,point[v]},point[v]=cnt;
}
void Ginit(){
	cnt = 0;
	SET(point,0);
}
*/
/*
struct hh{
	int a, b;
	bool operator < (const hh &x) const{
		if(a==x.a)return b<x.b;
		return a<x.a;
	}
}a[N];
*/
int n, m, k,q;
int main(){
//	freopen("1", "r", stdin);
	sc(n);
	rep(i,1,n){
		if(i%2==0)continue;
		int cnt = 0;
		rep(j,1,i)cnt += (i%j==0);
		if(cnt==8)m++;
	}
	pr(m),ln;
/*
	int Case;
	sc(Case);
	rep(ca, 1, Case){
	    printf("Case #%d: ", ca);
	}
*/
	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
	int W ,H ,x ,y ,r;
	scanf("%d%d%d%d%d" ,&W ,&H ,&x ,&y ,&r);
	if(x + r > W || x - r < 0 || y + r > H || y - r < 0){printf("No\n");
	}else if(x - r >= 0 && x + r <= W && y - r >= 0 && y + r <= H){printf("Yes\n");
	}
	return 0;
}


Measured memory_bytes: 2144
#include<deque>
#include<cstdio>
#include<algorithm>
using namespace std;
const int MAXN = 500005;
int n, L;
double V, T;
struct X { double t, v; };
deque<X> q;

int main() {
	scanf("%d%d", &n, &L);
	for(int t, v, i = 1; i <= n; ++i) {
		scanf("%d%d", &t, &v);
		V += v; T += 1.0 * t * v;
		while(V > L)
		if(V - L >= q.front().v) {
			V -= q.front().v;
			T -= q.front().v * q.front().t;
			q.pop_front();
		}
		else {
			q.front().v -= V - L;
			T -= q.front().t * (V - L);
			V = L;
		}
		
		printf("%.7lf\n", T / V);
		X delta = (X) { t, v };
		
		while(!q.empty() && q.back().t > delta.t) {
			delta.t = (delta.t * delta.v + q.back().t * q.back().v) / (delta.v + q.back().v);
			delta.v += q.back().v;
			q.pop_back();
		}
		q.push_back(delta);
	}
	return 0;
}

Measured memory_bytes: 17168
//#define _USE_MATH_DEFINES
#define _CRT_SECURE_NO_WARNINGS
//#include <cstdio>
//#include <cstdlib>
//#include <cmath>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <vector>
#include <string>
#include <map>
#include <list>
#include <queue>
#include <set>
using namespace std;

int main(void){

	int a, b, c;
	// char ;

	cin >> a >> b >> c;
	
	if(a > b) swap(a, b);
	if(a > c) swap(a, c);
	if(b > c) swap(b, c);
	
	cout << a <<" " << b << " " << c<<endl;

	return 0;
}

/*
for(i=0;i<N;i++){
	cin >> X[i];
}


for(i=0;i<N;i++){
	for(j=0;j<N;j++){
		cin >> X[i][j];
	}
}
*/

Measured memory_bytes: 1164
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define pp pair<int,int>
#define ll long long
#define ld long double
int inf=100000000;
ll INF=4000000000000000000;
ll MOD=1000000007;



int main() {
   int a,b;
   cin >> a >> b;
   if ((a+b)%2==1) cout << "IMPOSSIBLE" << endl;
   else cout << (a+b)/2 << endl;
  }

Measured memory_bytes: 256