akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
#include <stdlib.h>
#include <math.h>

#include <algorithm>
#include <array>
#include <iostream>
#include <numeric>
#include <string>
#include <vector>

int gcd(int x, int y) {
  x = std::abs(x); y = std::abs(y);
  int a = std::max(x,y), b = std::min(x,y);
  int r = a % b;
  while(r!=0){ a = b; b = r; r = a % b; }
  return b;
}

int main(void) {
  int N, M, X, Y;
  scanf("%d %d %d %d", &N, &M, &X, &Y);
  for (int i = 0; i < N; ++i) {
    int x;
    scanf("%d", &x);
    X = std::max(X, x);
  }
  for (int i = 0; i < M; ++i) {
    int y;
    scanf("%d", &y);
    Y = std::min(Y, y);
  }
  if (X < Y) puts("No War");
  else puts("War");
  return 0;
}

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

int main() {
    int N;
    cin >> N;
    vector<int>A(N+1);
    vector<int>B(N+1);
    for (int i = 1; i <= N; ++i) {
        cin >> A[i] >> B[i];
    }

    vector<pair<int, int>>cost;
    cost.reserve(2*N);
    for (int i = 1; i <= N; ++i) {
        cost.push_back({A[i], i});
        cost.push_back({B[i], -i});
    }
    sort(cost.begin(), cost.end());

    vector<int>flag(N+1, 0);
    ll ans = 0;
    for (int i = 0; i < N; ++i) {
        ans += cost[i].first;
        int f = cost[i].second;
        if(f > 0){
            flag[f] += 1;
        } else{
            flag[-f] += 2;
        }
    }

    if(cost[N].first == cost[N-1].first){
        cout << ans << "\n";
        return 0;
    }

    int flagA = 1;
    int flagB = 1;
    for (int i = 1; i <= N; ++i) {
        if(flag[i] == 2){
            flagA = 0;
        } else if(flag[i] == 1){
            flagB = 0;
        } else{
            cout << ans << "\n";
            return 0;
        }
    }
    if(flagA || flagB){
        cout << ans << "\n";
        return 0;
    }

    if(cost[N-1].second + cost[N].second == 0){
        int temp = cost[N].first - cost[N-2].first;
        temp = min(temp, cost[N+1].first - cost[N-1].first);
        ans += temp;
    } else{
        ans = ans - cost[N-1].first + cost[N].first;
    }
    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 2944
#include<bits/stdc++.h>
#define rep(i,n) for(int i = 0;i<n;i++)
using namespace std;
int main(){
  int n;
  cin>>n;
  vector<int> v(n);
  vector<int> c(n);
  rep(i,n)cin>>v[i];
  rep(i,n)cin>>c[i];
  int ans =0;
  rep(i,n){
    if(v[i]-c[i]>0)ans+=(v[i]-c[i]);
  
  }
  cout << ans <<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (int)(n); i++)
#define REP(i,n) for (int i = 1; i < (int)(n); i++)
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define vout(x) rep(i,x.size()) cout << x[i] << " "
template<class T> bool chmin(T &a, T b) {if(a>b) {a=b;return 1;}return 0;}
template<class T> bool chmax(T &a, T b) {if(a<b) {a=b;return 1;}return 0;}
using namespace std;
using vint = vector<int>;
using vvint = vector<vector<int>>;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<int,int>;
const int inf = 1e9;
const ll inf_l = 1e18;
const int MAX = 1e5;

int main() {
    int n, m; cin >> n >> m;
    vint h(n);
    rep(i,n) cin >> h[i];
    vvint path(n);
    rep(i,m) {
        int a, b; cin >> a >> b;
        a--; b--;
        path[a].push_back(b);
        path[b].push_back(a);
    }
    int ct = 0;
    rep(i,n) {
        bool ok = true;
        for (int x : path[i]) {
            if (h[i] <= h[x]) ok = false;
        }
        if (ok) ct++;
    }
    cout << ct << endl;
}

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

int main() {
    int a,b,c;
    cin>>a>>b>>c;
    if(a==b)
        cout<<c<<'\n';
    if(a==c)
        cout<<b<<'\n';
    if(b==c)
        cout<<a<<'\n';
	return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#define MOD 1000000007
//#define MOD 998244353
const double EPS = 1e-9;
#define INF (1LL<<60)
#define D double
#define fs first
#define sc second
#define int long long
#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define RFOR(i,a,b) for(int i = (int)(b-1);i>=(int)(a);--i)
#define REP(i,n)  FOR(i,0,(n))
#define RREP(i,n) RFOR(i,0,(n))
#define ITR(itr,mp) for(auto itr = (mp).begin(); itr != (mp).end(); ++itr)
#define RITR(itr,mp) for(auto itr = (mp).rbegin(); itr != (mp).rend(); ++itr)
#define range(i,a,b) ((a)<=(i) && (i)<(b))
#define debug(x)  cout << #x << " = " << (x) << endl;
#define SP << " " << 
typedef pair<int,int> P;
typedef vector<int> vec;
typedef vector<vector<int>> mat;

void add(int &a, int b){
  a = ((a+b) % MOD + MOD) % MOD;
}

inline int mul(int a, int b) {
    add(a,0); add(b,0);
    #if !defined(_WIN32) || defined(_WIN64)
      return (int) ((long long) a * b % MOD);
    #endif
      unsigned long long x = (long long) a * b;
      unsigned xh = (unsigned) (x >> 32), xl = (unsigned) x, d, m;
      asm(
        "divl %4; \n\t"
        : "=a" (d), "=d" (m)
        : "d" (xh), "a" (xl), "r" (MOD)
      );
      return m;
}

inline int modpow(int a, long long b) {
  int res = 1;
  while (b > 0) {
    if (b & 1) {
      res = mul(res, a);
      }
      a = mul(a, a);
      b >>= 1;
  }
  return res;
}

inline int inv(int a) {
    a %= MOD;
    if (a < 0) a += MOD;
    int b = MOD, u = 0, v = 1;
    while (a) {
      int t = b / a;
      b -= t * a; swap(a, b);
      u -= t * v; swap(u, v);
    }
    assert(b == 1);
    if (u < 0) u += MOD;
    return u;
}
 
signed main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.precision(20);
  
  int n, m;
  cin >> n >> m;

  vector<int> a(n);
  REP(i,n) cin >> a[i];
  
  sort(a.begin(), a.end(), greater<int>());

  vec b;

  int sum = 0;
  REP(i, n){
    sum += a[i];
    while(a[i] >= 1){
      b.push_back(a[i] - a[i] / 2);
      a[i] /= 2;
    }
  }

  sort(b.begin(), b.end(), greater<int>());

  for(int i = 0; i < m && i < (int)b.size(); i++){
    sum -= b[i];
  }

  cout << sum << endl;

  return 0;
}


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


double maxvolume(double s)
{
    // finding length
    double length = s / 3.0;

    s -= length;

    // finding breadth
    double breadth = s / 2.0;

    // finding height
    double height = s - breadth;

    return length * breadth * height;
}
int main()
{
    ios_base::sync_with_stdio(false); cin.tie(NULL);
    double l;
    cin>>l;
    cout<<fixed<<setprecision(6)<<maxvolume(l);
}



Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int[] p = new int[n];
        int[] q = new int[n];
        for (int i=0;i<n;i++){
            p[i] = scanner.nextInt();
        }
        for (int i=0;i<n;i++){
            q[i] = scanner.nextInt();
        }
        ArrayList<Integer> integer1 = new ArrayList<>();
        for (int i=1;i<=n;i++){
            integer1.add(i);
        }
        int count1=0;
        for (int i=0;i<n-1;i++){
            count1 += integer1.indexOf(p[i])*fact(n-i-1);
            integer1.remove((Integer) p[i]);
            Collections.sort(integer1);
        }

        ArrayList<Integer> integer2 = new ArrayList<>();
        for (int i=1;i<=n;i++){
            integer2.add(i);
        }
        int count2=0;
        for (int i=0;i<n-1;i++){
            count2 += integer2.indexOf(q[i])*fact(n-i-1);
            integer2.remove((Integer) q[i]);
            Collections.sort(integer2);
        }

        System.out.println(Math.abs(count1-count2));
    }
    public static int fact(int num){
        int h=1;
        for (int i=1;i<=num;i++){
            h *= i;
        }
        return h;
    }

}

Measured memory_bytes: 21844
#include <stdio.h>
typedef long long ll;
#define rep(i,n) for(ll i=0; i<(ll)(n); i++)
#define max(l,r) ((l)>(r)?l:r)

int dp[105][10101] = {0};
int main(){
    int N, W;
    scanf("%d%d", &N, &W);
    int v[105], w[105];
    rep(i, N) scanf("%d%d", v+i, w+i);

    rep(i, N){
        rep(j, W+1){
            dp[i+1][j] = dp[i][j];
            if(j - w[i] >= 0){
                dp[i+1][j] = max(dp[i+1][j], dp[i][j-w[i]] + v[i]);
                dp[i+1][j] = max(dp[i+1][j], dp[i+1][j-w[i]] + v[i]);
            }
        }
    }

    printf("%d\n", dp[N][W]);
}


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

using namespace std;

typedef long long ll;
typedef pair<int, int> P;
const int INF = 1000000;

signed main()
{
    int a, b; cin >> a >> b;
    if (a < 1 || a > 9) {
      cout << -1 << endl;
      return 0;
    }
    if (b < 1 || b > 9) {
      cout << -1 << endl;
      return 0;
    }
    cout << (a * b) << endl;
 }

Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <algorithm>
using namespace std;
int main() {
	int a,b,c,d;
	cin >> a;
	cin >> b;
	cin >> c;
	//cin >> d;
	a+b>=c ? cout <<"Yes"<< endl: cout << "No" << endl;
}

Measured memory_bytes: 256
import logging
import collections

logging.basicConfig(level=logging.INFO, format="%(message)s")
#logging.disable(logging.CRITICAL)

def main():
    N = int(input())
    A_i = list(map(int, input().split()))
    
    Ai_plu_i = collections.Counter([i + 1 + A_i[i] for i in range(N)])
    ans = sum([Ai_plu_i.get(j + 1 - A_i[j], 0) for j in range(N)])
    
    print(ans)
    
if __name__ == "__main__":
    main()


Measured memory_bytes: 44060
#include<stdio.h>  
#define MAX 100
#define INF 1000000
#define WHITE 0
#define GRAY 1
#define BLACK 2
int n, u;
int M[MAX][MAX];

void MST(){
  int i,min,d[MAX],color[MAX]={WHITE};
  for(i = 0;i < n;i++){
    d[i] = INF;
  }
  d[0] = 0;
  color[0] = GRAY;
  while(1){
    min = INF;
    u = -1;
    for(i = 0;i < n;i++)
      if(min > d[i] && color[i] != BLACK){
	u = i;
	min = d[i];
      }
    if(u == -1){
      break;
    }
    color[u] = BLACK;
    for(i = 0;i < n;i++)
      if(color[i] != BLACK && M[u][i] != INF){
	if(d[i] > d[u] + M[u][i]){
	  d[i] = d[u] + M[u][i];
	  color[i] = GRAY;
	}
      }
  }
  for(i = 0;i < n;i++){
    if(d[i] == INF){
      printf("%d -1\n",i);
    }
    else{
      printf("%d %d\n",i,d[i]);
    }
  }
}
 
int main(){
  int i,j,k,v,c;
  scanf("%d",&n);
  for(i = 0 ;i < n;i++){
    for(j = 0;j < n;j++){
      M[i][j] = INF;
    }
  }
  for(i = 0;i < n;i++){
    scanf("%d %d",&u,&k);
    for(j = 0;j < k;j++){
      scanf("%d %d",&v,&c);
      M[u][v] = c;
    }
  }
  MST();
  return 0;
}
  

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

using namespace std;

#define ll long long 
#define Fastest ios_base :: sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define endl "\n"

int main()
{
    ll a,b,c,d;
    
    cin >> a >> b >> c >> d;
    
    ll ans1 = (b/c) - (a/c);
    
    if(a%c == 0) ans1++;
    
    ll ans2 = (b/d) - (a/d);
    
    if(a%d == 0) ans2++;
    
    ll anss = (c*d) / (__gcd(c,d));
    
    ll ans3 = (b/(anss)) - (a / (anss));
    
    if(a%anss == 0) ans3++;
    
    ll sum = ans1 + ans2 - ans3;
    
    cout << (b-a+1) - sum << endl;
	return 0;
}


Measured memory_bytes: 256
#[allow(unused_imports)]
use std::cmp::*;
#[allow(unused_imports)]
use std::collections::*;
use std::io::{Write, BufWriter};
// 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<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, [ $t:tt ]) => {{
        let len = read_value!($next, usize);
        (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    }};

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn solve() {
    let out = std::io::stdout();
    let mut out = BufWriter::new(out.lock());
    macro_rules! puts {
        ($($format:tt)*) => (write!(out,$($format)*).unwrap());
    }
    input! {
        a: i32,
        s: chars,
    }
    puts!("{}\n", if a >= 3200 { s.into_iter().collect() } else { "red".to_owned() });
}

fn main() {
    // In order to avoid potential stack overflow, spawn a new thread.
    let stack_size = 104_857_600; // 100 MB
    let thd = std::thread::Builder::new().stack_size(stack_size);
    thd.spawn(|| solve()).unwrap().join().unwrap();
}


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

ll dp[100005];

int main(void){
    int n,m;
    cin >> n >> m;
    vector<ll> dan(n+2,1);
    rep(i,m){
        int x;
        cin >> x;
        dan[x] = 0;
    }
    ll ans = 0;
    dp[0] = 0;
    if(dan[1]){
        dp[1] = 1;
    }
    else{
        dp[1] = 0;
    }
  	if(dan[2] && dan[1]){
    	dp[2] = 2;
    }
  	if(dan[2] && !dan[1]){
      	dp[2] = 1;
    }
  	if(!dan[2]){
      	dp[2] = 0;
    }
  
    for(int i=1;i<n;i++){
        if(dan[i+2]){
            dp[i+2] = dp[i+1] + dp[i];
          	dp[i+2] %= 1000000007;
        }
    }
    
    ans = dp[n] % 1000000007;
    
    cout << ans << endl;
    
    
    return 0;
}





























Measured memory_bytes: 1792
h, w = map(int, input().split())
a = []
for i in range(h):
    a.append(list(map(int, input().split())))

count = 0
ans = []
for i in range(h - 1):
    for j in range(w):
        if a[i][j] % 2 == 1:
            count += 1
            ans.append('{} {} {} {}'.format(i + 1, j + 1, i + 2, j + 1))
            a[i][j] -= 1
            a[i + 1][j] += 1
for j in range(w - 1):
    if a[h - 1][j] % 2 == 1:
        count += 1
        ans.append('{} {} {} {}'.format(h, j + 1, h, j + 2))
        a[h - 1][j] -= 1
        a[h - 1][j + 1] += 1

print(count)
for s in ans:
    print(s)

Measured memory_bytes: 16432
import java.io.*;
import java.math.*;
import java.util.*;





public class Main {

    static MyScanner in = new MyScanner();
    static   PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out));
    int N;
    static int max = 200001;
    static int [] dr = {1,-1,0,0};
    static int [] dc={0,0,-1,1};
    public static void main(String args[]) throws IOException {

        int count =0;
        int [] dp = new int[101];
        for(int i=1;i<=100;i++){
            int N = i;
             count =0;
        while(isEven(N)){
                N>>=1;
                count++;
        }
        dp[i] = count;
    }
    int N = in.nextInt();
    int max =-1;
    int ans =0;
    for(int i=1;i<=N;i++)
        {
            if(max<dp[i])
            {
                ans = i;
                max = dp[i];
            }
        }
        out.println(ans);

        out.flush();
        }
       static boolean isEven(long a){
            return (a&1)==0;
        }
       static  void swap (int a, int b){

        int temmp = b;
        b=a;
        a = temmp;
        }
        static boolean same(int [] arr,int [] temp){
            Arrays.sort(arr);
           Arrays.sort(temp);
            for(int i=0;i<arr.length;i++){
                if(temp[i]!=arr[i])
                return false;
            }
            return true;
        }

 
  


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

Measured memory_bytes: 21332
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    int     idx = 0, dig = 0, in = 0, num = 0;
    int     ans[3] = {-1, -1, -1};
    cin >> dig >> in;
    if (in == 0)
    {
        if (dig > 1)
        {
            cout << 1;
            dig--;
        }
        while (dig-- > 0)
            cout << 0;
        return (0);
    }
    while (in-- > 0)
    {
        cin >> idx >> num;
        if ((ans[idx - 1] != -1 && ans[idx - 1] != num) || (dig > 1 && idx == 1 && num == 0))
        {
            cout << -1 << endl;
            return (0);
        }
        ans[idx - 1] = num;
    }
    for (int i = 0; i < dig; i++)
    {
        if (ans[i] == -1 && i == 0)
            cout << 1;
        else if (ans[i] == -1)
            cout << 0;
        else
            cout << ans[i];
    }
    cout << endl;
    return (0);
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define cy cout << "YES" << endl;
#define cn cout << "NO" << endl;
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
using namespace std;
int main()
{

    string s;
    cin >> s;
    map<char,int>mp;
    int m=0;
    for(int i=0;i<s.length();i++)
    {
        mp[s[i]]++;
    }
    for(auto it=mp.begin();it!=mp.end();it++)
    {
        if((it->second)%2!=0)
        {
            m++;
        }
    }
    if(m>0)
    {
        cout << "No" << endl;
    }
    else{
        cout << "Yes" << endl;
    }


}

Measured memory_bytes: 3588
string = input()

for i in range(len(string)):
    s = string[:-(i+1)]

    if len(s)%2 == 1:
        continue
    else:
        half = int(len(s)/2)
        s1 = s[:half]
        s2 = s[half:]

        if s1 == s2:
            print(half*2)
            break

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

int main(){
long long int n,b,r;
cin>>n>>b>>r;
long long int ans=0;
ans=b*(n/(b+r));
if(n%(b+r)<=b){
  ans=ans+n%(b+r);
}
else{
  ans=ans+b;
}
cout<<ans<<endl;
return 0;
}



Measured memory_bytes: 256
#include"bits/stdc++.h"
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
const int mod = 1000000007;
typedef pair<int, int> P;
int d[55];
signed main() {
	int n; cin >> n;
	string s; cin >> s;
	int ans = 0;
	char now = s[0];
	s.push_back('@');
	rep(i, n+1) {
		if (now != s[i]) {
			ans++;
		}
		now = s[i];
	}
	cout << ans << endl;
}


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

using namespace std;

#define YES cout << "YES" << endl;
#define NO  cout << "NO"  << endl;
#define Yes cout << "Yes" << endl;
#define No  cout << "No"  << endl;
 
#define INF INT_MAX
#define MOD 1000000007
#define PI  acos(-1)

using ll  = long long;
using ull = unsigned long long;
using Pii = pair<int, int>;
using Pll = pair<ll, ll>;

#define rep(i, n) for (ll i = 0; i < (n); i++)
#define rrep(i, n) for (ll i = (n)-1; i >= 0; i--)

int main(int argc, char *argv[])
{
    cin.tie(0);
    ios::sync_with_stdio(false);

    ll N, M;
    cin >> N >> M;

    priority_queue<ll> pq;
    rep (i, N) {
        ll A;
        cin >> A;
        pq.push(A);
    }

    while (M > 0) {
        ll tmp = pq.top()/2;
        pq.pop();
        pq.push(tmp);
        M--;
    }

    ll ans = 0;
    while (!pq.empty()) {
        ans += pq.top();
        pq.pop();
    }

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

Measured memory_bytes: 1400
#include <iostream>
#include<vector>
using namespace std;
int main(void){
    int n;
    cin >> n;
    vector<int> v(2001);
    v[0] = 1;
    int x = 0;
    for(int i = 1;i < 2001;i++){
         if(i - 3 >= 0){
               x += v[i - 3];
               x %= 1'000'000'007;
         }
         v[i] = x;
    }
    cout << v[n] << endl;
}


Measured memory_bytes: 3640
#include <bits/stdc++.h>
using namespace std;
#define storpa ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
int main(){
      storpa;
      bool p=true;
      string s;
      int a[101]{};
      cin >> s;
      for(int i=0; i<s.size(); i++){
        ++a[s[i]-'a'];
      }
      for(int i=0;i<=26; i++){
        if(a[i]%2!=0){
          p=false;
          break;
        }
      }
      if(p==true){
        cout << "Yes";
      }
      else cout << "No";
}


Measured memory_bytes: 3620
#!/usr/bin/env fsharpi

open System;

let readIntN ( str : string ) =
    str.Split(' ')
    |> Array.map System.Int32.Parse

let readInt1 ( str : string ) =
    readIntN str |> fun arr -> arr.[0]

let readInt2 ( str : string ) =
    readIntN str |> fun arr -> (arr.[0],arr.[1])

let readInt3 ( str : string ) =
    readIntN str |> fun arr -> (arr.[0],arr.[1],arr.[2])


type UnionFind (N) =
    let id : int[] = Array.init N (fun i -> i )
    let sz : int[] = Array.create N 1

    member t.root i =
        let mutable q = i
        while ( q <> id.[q] ) do
            id.[q] <- id.[id.[q]]
            q <- id.[q]
        q

    member t.find( p, q ) =
        t.root(p) = t.root(q)

    member t.unite( p, q ) =
        let i = t.root( p )
        let j = t.root( q )
        if sz.[i] < sz.[j] then id.[i] <- j; sz.[j] <- sz.[j] + sz.[i]
        else id.[j] <- i; sz.[i] <- sz.[i] + sz.[j]

let (n,k,l) = readInt3 <| Console.ReadLine()

let rail = UnionFind (n+1)
for i = 1 to k do
    let (p,q) = readInt2 <| Console.ReadLine()
    rail.unite( p, q )
done

let road = UnionFind (n+1)
for i = 1 to l do
    let (p,q) = readInt2 <| Console.ReadLine()
    road.unite( p, q )
done

let cnt_map = new System.Collections.Generic.Dictionary< int * int, int >()
for i = 1 to n do
    let root_tuple = ( (rail.root i), (road.root i) )
    if cnt_map.ContainsKey root_tuple then
        cnt_map.[ root_tuple ] <- cnt_map.[ root_tuple] + 1
    else
        cnt_map.Add( root_tuple, 1 )
done

for i = 1 to n do
    let root_tuple = ( (rail.root i), (road.root i) )
    let cnt = cnt_map.[ root_tuple ]
    Console.Write( cnt )
    if i <> n then
        Console.Write( ' ' )
    else
        Console.Write( '\n' )
done


Measured memory_bytes: 37904
#include <iostream>
#include <limits>
#include <cfenv>
#include <cmath>
#include <algorithm>
#include <array>
#include <bitset>
#include <cstring>
#include <map>
#include <stack>
#include <set>
#include <tuple>
#include <queue>
#include <vector>
#include <cmath>
#include <random>
#include <math.h>
#include <list>
#include <random>
#include <functional>


#define FOR(i, a, b) for(int (i) = (a); (i) < (b); ++(i))
#define REP(i, n) FOR(i, 0, n)
#define rREP(i, n) for(int (i) = (n) - 1; (i) >= 0; --(i))
#define ALL(TheArray) TheArray.begin(), TheArray.end()

using lli = long long int;
using pii = std::pair<int, int>;

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


// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


constexpr int K = 17; // 2^17 > 1e5
constexpr int N = 1e5;
std::array<std::array<int, N>, K+1> A;
std::array<int, N> X;

int main(void){
    int n; scanf("%d", &n);
    REP(i, n) scanf("%d", &X[i]);

    int L; scanf("%d", &L); int l = 0, r = 1;
    while(l < n){
        while(r < n and X[r] - X[l] <= L) r++;
        A[0][l] = r - 1; l++;
    }
    REP(t, K) REP(i, n) A[t+1][i] = A[t][A[t][i]];

    int Q; scanf("%d", &Q);
    while(Q--){
        int a, b; scanf("%d%d", &a, &b); a--; b--;
        if(a > b) std::swap(a, b);
        int res = 0; int ptr = a;
        while(ptr < b){
            int cnt = 0;
            while(cnt + 1 <= K and A[cnt + 1][ptr] < b) cnt++;
            res += (1 << cnt);
            ptr = A[cnt][ptr];
        }
        printf("%d\n", res);
    }
    return 0;
}

Measured memory_bytes: 8192
#include<bits/stdc++.h> 
using namespace std;
int main()
{
	int n, x[105],l=101,r=0;
	cin>>n;
	for(int i = 0;i < n;i++){
		cin>>x[i];
		if(x[i] > r) r = x[i];
		if(x[i] < l) l = x[i];
	}
	int ans=10000000,sum;
	for(int i = l;i <= r;i++){
		sum = 0;
		for(int j = 0;j < n;j++){
			sum += (i - x[j]) * (i - x[j]);
		}
		if(sum < ans) ans = sum;
	}
	cout<<ans;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<iostream>
using namespace std;
int main()

{
  int x,y;
  cin>>x>>y;
  if((x+y)%3==0 || x%3==0 || y%3==0)
    cout<<"Possible"<<endl;
  else
    cout<<"Impossible"<<endl;


 return 0;
}








Measured memory_bytes: 3588
def solve():
    from sys import stdin
    f_i = stdin
    
    n = int(f_i.readline())
    A = map(int, f_i.readline().split())
    
    m = int(f_i.readline())
    B = tuple(map(int, f_i.readline().split()))
    
    i = 0
    for a in A:
        if a == B[i]:
            i += 1
            if i == m:
                print(1)
                break
    else:
        print(0)

solve()


Measured memory_bytes: 41416
#include<stdio.h>
main(){
  int total=0,ave=0,volume,unit,count=0;
  while(scanf("%d,%d",&unit,&volume) != EOF){
    total+=volume*unit;
    ave+=volume;
    count++;
  }
  ave=(ave+1.05)/count;
  printf("%d\n%d\n",total,ave);
  return 0;
}

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

#define ll          long long
#define pb          push_back
#define endl        '\n'
#define mii         map<ll,ll>
#define pii         pair<ll,ll>
#define vi          vector<ll>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (ll)x.size()
#define hell        1000000007
#define INF         (1ll<<60)
#define rep(i,a,b)  for(ll i=a;i<=b;i++)
#define rrep(i,a,b)  for(ll i=a;i>=b;i--)
#define ios ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define time        cerr << "\nTime elapsed: " << 1000 * clock() / CLOCKS_PER_SEC << "ms\n";
ll gcd(ll a, ll b) { return b == 0 ? a : gcd(b, a % b); }
ll lcm(ll a, ll b) { return a * (b / gcd(a, b)); }
const int N=100005;
void solve(){
    char c;
    cin>>c;
    cout<<(char)(c+1)<<endl;
}
signed main()
{
    ios
    int TESTS=1;
    //cin>>TESTS;
    while(TESTS--){
        solve();
    }
    time
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define l(i) (n/2-(n-i+1)/2)
#define r(i) (i+1)/2
#define st(i) i/2-1
using namespace std;
typedef long long ll;
int n,a[200005];
ll dp[200005][3],ans=-1e16;//j的范围在i/2-1到(i+1)/2，最多3个
int main() {
	cin>>n;
	for(int i=1; i<=n; i++)
		cin>>a[i];
	for(int i=1; i<=n; i++) {
		for(int j=0; j<3; j++)
			dp[i][j]=(!i?0:-1e16);
	}
	dp[1][1-st(1)]=a[1],dp[1][0-st(1)]=0;
	for(int i=2; i<=n; i++) {
		for(int j=l(i); j<=r(i); j++) {
			if(j==0) dp[i][j-st(i)]=0;
			else {
				for(int k=i-2; l(k)<=j-1&&r(k)>=j-1&&k>=0; k--)
					dp[i][j-st(i)]=max(dp[i][j-st(i)],dp[k][j-1-st(k)]+a[i]);
			}
		}
	}
	for(int i=n/2; i<=n; i++)
		for(int j=l(i); j<=r(i); j++)
			j==n/2 ? ans=max(ans,dp[i][j-st(i)]):0;
	cout<<ans;
	return 0;
}

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

using namespace std;
#define ll long long

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



int main(){
	ll a,b;
	cin>>a>>b;
	cout<<a*b/gcd(a,b);
}

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

// #undef DEBUG  // Uncomment this line to forcefully disable debug print.
#if DEBUG
template <typename T>
void debug(T value) {
  std::cerr << value;
}
template <typename T, typename... Ts>
void debug(T value, Ts... args) {
  std::cerr << value << ", ";
  debug(args...);
}
#define dbg(...)                              \
  do {                                        \
    cerr << #__VA_ARGS__ << ": ";             \
    debug(__VA_ARGS__);                       \
    cerr << " (L" << __LINE__ << ")" << endl; \
  } while (0)
#else
#define dbg(...)
#endif

void read_from_cin() {}
template <typename T, typename... Ts>
void read_from_cin(T& value, Ts&... args) {
  std::cin >> value;
  read_from_cin(args...);
}
#define in(type, ...) \
  type __VA_ARGS__;   \
  read_from_cin(__VA_ARGS__);

template <typename T>
void write_to_cout(const T& value) {
  std::cout << value << std::endl;
}
template <typename T, typename... Ts>
void write_to_cout(const T& value, const Ts&... args) {
  std::cout << value << ' ';
  write_to_cout(args...);
}
#define out(...) write_to_cout(__VA_ARGS__);

#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)

using ll = long long;

using namespace std;

int main() {
  in(int, n);
  int ans = 0;
  function<void(string, bool, bool, bool)> rec = [&](string s, bool three,
                                                     bool five, bool seven) {
    if (s.size() >= 10) return;
    if (three && five && seven && stoll(s) <= n) ++ans;
    rec(s + '3', true, five, seven);
    rec(s + '5', three, true, seven);
    rec(s + '7', three, five, true);
  };
  rec("", false, false, false);
  out(ans);
}


Measured memory_bytes: 3620
#include<iostream>
#include<algorithm>
#include<string>
#include<cstdlib>
#include<map>
#include<iomanip>
#include<sstream>
#include<vector>
#include<stack>
#include<math.h>
using namespace std;

long long int num[5000]={1};

int main() {
	cout << fixed << setprecision(10);
	long long k,t,a[10005],mymax=0,sum=0;
	cin>>k>>t;
	for(int i=0;i<t;i++)
	{
		cin>>a[i];
		mymax=max(mymax,a[i]);
		sum+=a[i];
	}
	sum-=mymax;
	if(mymax<=sum+1)
	{
		cout<<0<<endl;
	}else
	{
		cout<<mymax-sum-1<<endl;
	}
}


Measured memory_bytes: 256
#include <iostream>//cout<<right で右揃え
#include <iomanip>//cout<<setw(数字) で空白による桁揃え
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <algorithm>
#include <cstdlib>//abs()で整数絶対値
#include <cmath>//abs()かfabs()で少数絶対値
#include <functional>//sort第三引数greater<型名>()で降順
#include <map>

using namespace std;
using ll = long long int;

int main(){
    int N,X,T;cin>>N>>X>>T;
    if(N%X==0) cout << N / X * T << endl;
    else cout << (N / X + 1) * T << endl;
    return 0;
}

Measured memory_bytes: 3636
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<cassert>
#include<complex>
#include<numeric>
using namespace std;

//#define int long long
typedef long long ll;

typedef unsigned long long ul;
typedef unsigned int ui;
constexpr ll mod = 1000000007;
const ll INF = mod * mod;
typedef pair<int, int>P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
#define all(v) (v).begin(),(v).end()
typedef pair<ll, ll> LP;
typedef long double ld;
typedef pair<ld, ld> LDP;
const ld eps = 1e-12;
const ld pi = acos(-1.0);

ll mod_pow(ll x, ll n) {
	ll res = 1;
	while (n) {
		if (n & 1)res = res * x%mod;
		x = x * x%mod; n >>= 1;
	}
	return res;
}
struct modint {
	ll n;
	modint() :n(0) { ; }
	modint(ll m) :n(m) {
		if (n >= mod)n %= mod;
		else if (n < 0)n = (n%mod + mod) % mod;
	}
	operator int() { return n; }
};
bool operator==(modint a, modint b) { return a.n == b.n; }
modint operator+=(modint &a, modint b) { a.n += b.n; if (a.n >= mod)a.n -= mod; return a; }
modint operator-=(modint &a, modint b) { a.n -= b.n; if (a.n < 0)a.n += mod; return a; }
modint operator*=(modint &a, modint b) { a.n = ((ll)a.n*b.n) % mod; return a; }
modint operator+(modint a, modint b) { return a += b; }
modint operator-(modint a, modint b) { return a -= b; }
modint operator*(modint a, modint b) { return a *= b; }
modint operator^(modint a, int n) {
	if (n == 0)return modint(1);
	modint res = (a*a) ^ (n / 2);
	if (n % 2)res = res * a;
	return res;
}

ll inv(ll a, ll p) {
	return (a == 1 ? 1 : (1 - p * inv(p%a, a)) / a + p);
}
modint operator/(modint a, modint b) { return a * modint(inv(b, mod)); }

const int max_n = 1 << 21;
modint fact[max_n], factinv[max_n];
void init_f() {
	fact[0] = modint(1);
	for (int i = 0; i < max_n - 1; i++) {
		fact[i + 1] = fact[i] * modint(i + 1);
	}
	factinv[max_n - 1] = modint(1) / fact[max_n - 1];
	for (int i = max_n - 2; i >= 0; i--) {
		factinv[i] = factinv[i + 1] * modint(i + 1);
	}
}
modint comb(int a, int b) {
	if (a < 0 || b < 0 || a < b)return 0;
	return fact[a] * factinv[b] * factinv[a - b];
}

void solve() {
	int k; cin >> k;
	string s; cin >> s;
	int n = s.size();
	modint ans = 0;
	rep(x, k + 1) {
		modint sum = comb(n - 1 + k - x, k - x)*(modint)mod_pow(25, k - x)*(modint)mod_pow(26, x);
		ans += sum;
	}
	cout << ans << "\n";
}


signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	//cout << fixed << setprecision(10);
	init_f();
	//int t; cin >> t; rep(i, t)
		solve();
	stop
		return 0;
}


Measured memory_bytes: 37016
n,m=map(int,input().split())
a=[input() for i in range(n)]
b=[input() for j in range(m)]

count=0

for k in range(n-m+1):
    for j in range(n-m+1):
        for i in range(m):
            if a[i+k][j:j+m]==b[i]:
                count+=1
        if count==m:
            print("Yes")
            exit()
        count=0
print("No")

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

namespace ConsoleApp10
{
    class Program
    {
        static void Main(string[] args)
        {
            int  b, c;
            string[] str = Console.ReadLine().Split(' ');//2つ以上のスペース区切り入力の取得
            b = int.Parse(str[0]);  //数値で受け取りたい場合は変換する
            c = int.Parse(str[1]);
            if(b == c)
            {
                Console.WriteLine("Yes");
            }
            else
            {
                Console.WriteLine("No");
            }
        }
    }
}


Measured memory_bytes: 13140
#include<iostream>
int main(){
  std::string l[1000];
  int c=0,k;
  while(std::cin>>l[c]) {
    if((l[c].find(","))+(l[c].find("."))!=-2)
      l[c].replace(l[c].length()-1,1,"");
    if( (l[c].length()>2)&&(l[c].length()<7))
      c++;
  }
  for(k=0;k<c;k++) {
    std::cout<<l[k];
    if(k!=c-1) std::cout<<" ";
}
  std::cout<<"\n";
}

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

struct UnionFind {
  vector<int> par;
  vector<int> siz;

  UnionFind(int N) : par(N),siz(N) {
    for(int i=0; i<N; i++) {
      par[i]=i;
      siz[i]=1;
    }
  }

  int root(int x) {
    if(par[x]==x) return x;
    return par[x] = root(par[x]);
  }

  void unite(int x, int y) {
    int rx = root(x);
    int ry = root(y);
    if(rx==ry) return;
    par[rx] = ry;
    siz[ry]+=siz[rx];
  }

  bool same(int x, int y) {
    int rx = root(x);
    int ry = root(y);
    return rx == ry;
  }

  int size(int x) {
    return siz[root(x)];
  }
};

int main() {
  int N,M,K; cin>>N>>M>>K;
  UnionFind friendTree(N);
  vector<int> candidateList(N,0);
  for(int i=0; i<M; i++) {
    int x,y; cin>>x>>y;
    // 木をくっつける
    friendTree.unite(x-1,y-1);
    candidateList[x-1]--;
    candidateList[y-1]--;
  }
  for(int i=0; i<K; i++) {
    int x,y; cin>>x>>y;
    if(friendTree.same(x-1,y-1)) {
      candidateList[x-1]--;
      candidateList[y-1]--;
    }
  }
  for(int i=0; i<N; i++) {
    candidateList[i]+=friendTree.size(i);
    candidateList[i]--;
    cout << candidateList[i] << " ";
  }
  cout << endl;
}


Measured memory_bytes: 5420
#include <cstdio>
#include <iostream>
 
using namespace std;
 
int main() {
    int num;
    for (int i = 1;; ++i) {
        scanf("%d", &num);
        if(0 == num) {
            break;
        }else {
            printf("Case %d: %d\n", i, num);
        }
    }
    return 0;
}

Measured memory_bytes: 1188
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
struct node{ 
  int key;
  struct node *next;
  struct node *prev;
};
typedef struct node * NodePointer;
NodePointer nil;
NodePointer listSearch(int key){
  NodePointer i;
  for(i=nil;i->next!=nil;i=i->next){
  if(i->next->key==key)return i->next;
  }
  return NULL;
} 
void init(){
  nil = malloc(sizeof(struct node));
  nil->next = nil; 
  nil->prev = nil;
}
void printList(){ 
  NodePointer cur = nil->next;
  int isf = 1;
  while(1){
    if ( cur == nil ) break;
    if ( isf == 0) printf(" "); 
    printf("%d", cur->key);
    cur = cur->next; isf = 0; 
  } 
  printf("\n");
}
void deleteNode(NodePointer t){
  t->next->prev=t->prev;
  t->prev->next=t->next;
  free(t);
}
void deleteFirst(){ 
  NodePointer t = nil->next;
  if ( t == nil )return;
  deleteNode(t);
}
void deleteLast(){
  NodePointer i;
  i=nil->prev;
  deleteNode(i);
}
void delete(int key){
  NodePointer i; 
  i=listSearch(key);
  if(i!=NULL)deleteNode(i);
} 
void insert(int key){ 
  NodePointer x;
  x = malloc(sizeof(struct node));
  x->key = key;
  x->next=nil->next;
  nil->next->prev=x;
  nil->next=x;
  x->prev=nil;
}
int main(){ 
  int key, n, i;
  int size = 0; 
  char com[20]; 
  int np = 0, nd = 0;
  scanf("%d", &n); 
  init();
  for ( i = 0; i < n; i++ ){
    scanf("%s%d", com, &key);
    if ( com[0] == 'i' ) {
      insert(key);
      np++;
      size++;
    } 
    else if ( com[0] == 'd' ) {
      if (strlen(com) > 6){
	if ( com[6] == 'F' ) deleteFirst();
	else if ( com[6] == 'L' ) deleteLast();
      }
      else { delete(key); nd++; } size--; }
  }
  printList(); 
  return 0;
}

Measured memory_bytes: 31784
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using VI = vector<int>;
using VL = vector<ll>;
#define FOR(i,a,n) for(int (i)=(a);(i)<(n);(i)++)
#define eFOR(i,a,n) for(int (i)=(a);(i)<=(n);(i)++)
#define rFOR(i,a,n) for(int (i)=(n)-1;(i)>=(a);(i)--)
#define erFOR(i,a,n) for(int (i)=(n);(i)>=(a);(i)--)
#define SORT(i) sort((i).begin(),(i).end())
#define rSORT(i,a) sort((i).begin(),(i).end(),(a))
#define all(i) (i).begin(),(i).end()
constexpr ll INF = 1000000000;
constexpr ll LLINF = 1LL << 60;
constexpr ll mod = 1000000007;
constexpr ll MOD = 998244353;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; }return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; }return 0; }
inline void init() { cin.tie(nullptr); cout.tie(nullptr); cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(15); }
template<class T>inline istream& operator>>(istream& input, vector<T>& v) { for (auto& elemnt : v)input >> elemnt; return input; }

int main() {
    init();

    int n;
    cin >> n;
    string s;
    cin >> s;

    vector<VI> dp(n, VI(n, 0));
    FOR(i, 1, n)dp[0][i] += (s[0] == s[i]);

    FOR(i, 1, n)FOR(j, i + 1, n) {
        if (s[i] != s[j])continue;
        dp[i][j]++;
        dp[i][j] += dp[i - 1][j - 1];
        chmin(dp[i][j], j - i);
    }

    int ans = 0;
    FOR(i, 0, n)FOR(j, 0, n)chmax(ans, dp[i][j]);
    cout << ans << "\n";
}

Measured memory_bytes: 98176
#include<iostream>
#include<math.h>
#include<cctype>
#include<cerrno>
#include<cfloat>
#include<ciso646>
#include<climits>
#include<clocale>
#include<cmath>
#include<csetjmp>
#include<csignal>
#include<cstdarg>
#include<cstddef>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<ctime>
#include<string>
#include<string.h>
#include<map>
#include<vector>
#include<set>
#include<algorithm>
#include<stdio.h>
using namespace std;
map<int,int> num;
int main()
{
	long long n,a,ans=0;
	cin>>n;
	for(int i=0;i<n;i++)
	{
		cin>>a;
		if(num[a]==0)
		{
			ans++;
			num[a]=1;
		}
		else
		{
			ans--;
			num[a]=0;
		}
	}
	cout<<ans;
	return 0;
}

Measured memory_bytes: 4992
#include<stdio.h>

int main(){
	int n,i,j,k,l,d[1000000]={0},cnt;
	while(scanf("%d",&n)!=-1){
		for(i=2;i<=n;i++){
			if(d[i]) continue;
			else for(l=2;i*l<=n;l++) d[i*l]=1;
		}
		for(i=2;i<=n;i++) if(!d[i]) cnt++;
		printf("%d\n",cnt);
		cnt=0;
	}
	return 0;
}

Measured memory_bytes: 4508
menu = []

for i in range(5):
    i = int(input())
    menu.append(i)

from itertools import permutations
from math import ceil

min_sum = 10**10
for i in permutations(menu, 5):
    sum = 0
    for j in range(4):
        sum += ceil(i[j]/10) * 10
    sum += i[4]
    if sum < min_sum:
        min_sum = sum

print(min_sum)

Measured memory_bytes: 3064
import java.util.Scanner;

class Main{
	public static void main(String[] args) {
		Scanner stdIn=new Scanner(System.in);
		int n=stdIn.nextInt(),a=stdIn.nextInt(),b=stdIn.nextInt();
		if(a*n>b) System.out.print(b);
		else System.out.print(a*n);
	}
}

Measured memory_bytes: 22100
#include<iostream>
#include<cstdio>
#include<cstring>
#include <cstdlib>  
#include <cmath>   
#include<cctype>
#include<string>
#include <map>
#include<algorithm>
#include <functional>
#include<vector>
#include<climits>
#include<stack>
#include<queue>
#include <deque>
#include <utility> 

#define rep(i,m,n) for(int i = m;i < n;++i)
using namespace std;
using ll = long long;
using R = double;
const ll inf = 1LL << 50;
const ll MOD = 1e9 + 7;




int main(){
	ll n, m;
	cin >> n >> m;

	ll ans;
	if (m >= 2 * n) {
		ans = n;
		m -= 2 * n;
		ans += m / 4;
		cout << ans << endl;
	}
	else {
		ans = m / 2;
		cout << ans << endl;
	}


	return 0;
}



Measured memory_bytes: 256
#[allow(unused_imports)]
use std::cmp::*;
#[allow(unused_imports)]
use std::collections::*;
#[allow(unused_imports)]
use std::iter::*;
#[allow(unused_imports)]
use std::*;

macro_rules! test {
    ($($input:expr => $output:expr),* $(,)*) => {
#[test]
        fn solve_test() {
            $(
                assert_eq!(solve($input), $output);
            )*
        }
    };
}
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let mut s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

macro_rules! stdin {
    () => {{
        use std::io::Read;
        let mut s = String::new();
        std::io::stdin().read_to_string(&mut s).unwrap();
        s
    }};
}

fn main() {
    println!("{}", solve(&stdin!()));
}
fn solve(src: &str) -> String {
    input! {
        source = src,
        a:u64,
        b:String,
    }
    let b: u64 = b.replace(".", "").parse().unwrap();

    ((a * b) / 100).to_string()
}
test! {
    "198 1.10" => "217",
    "1 0.01" => "0",
    "1000000000000000 9.99" => "9990000000000000",
}


Measured memory_bytes: 2108
#include <iostream>
#include <sstream>
#include <algorithm>
#include <functional>
#include <iterator>
#include <numeric>
#include <cstdint>
#include <cmath>
#include <bitset>
#include <string>
#include <list>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>

#define N_TIMES(i, n)     for ( uint64_t i = 0;     i <  n; ++i )
#define N_TIMES_REV(i, n) for (  int64_t i = n - 1; i >= 0; --i )

using namespace std;

int main()
{
  uint64_t H, W;
  cin >> H >> W;

  vector<string> S(H);
  N_TIMES(y, H) { cin >> S[y]; }

  vector<vector<uint64_t>> dp(H, vector<uint64_t>(W, -1));
  dp[0][0] = (S[0][0] == '#') ? 1 : 0;
  for (uint64_t i = 1; i < H * W; ++i) {
    uint64_t y = i / W, x = i % W;
    
    if (S[y][x] == '#') {
      // 上から
      if (y > 0) {
        if (S[y - 1][x] == '.') {
          dp[y][x] = min(dp[y][x], dp[y - 1][x] + 1);
        } else {
          dp[y][x] = min(dp[y][x], dp[y - 1][x]);
        }
      }
      
      // 左から
      if (x > 0) {
        if (S[y][x - 1] == '.') {
          dp[y][x] = min(dp[y][x], dp[y][x - 1] + 1);
        } else {
          dp[y][x] = min(dp[y][x], dp[y][x - 1]);
        }
      }
    } else { // S[y][x] == '.'
      // 上から
      if (y > 0) {
        dp[y][x] = min(dp[y][x], dp[y - 1][x]);
      }
      
      // 左から
      if (x > 0) {
        dp[y][x] = min(dp[y][x], dp[y][x - 1]);
      }
    }
  }
  cout << dp[H - 1][W - 1] << endl;

  return 0;
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
///////////////////////////////////Nikhil Srivastava////////////////////////////////////////
///////////////////////////////////IIT Jodhpur//////////////////////////////////////////////
///////////////////////////////////Bazinga//////////////////////////////////////////////////
#define SPEED ios::sync_with_stdio(false); cin.tie(0)
#define sci(a) scanf("%d",&a)
#define scl(a) scanf("%I64d",&a)
#define scc(a) scanf("%c",&a)
#define scf(a) scanf("%f",&a)
#define scd(a) scanf("%lf",&a)
#define scs(a) scanf("%s",&a)
#define printi(x) printf("%d\n",x)
#define printl(x) printf("%lld\n",x)
#define loop(i,a,n) for(int i=a;i<n;++i)
#define loopd(i,a,n) for(int i=a;i>=n;--i)
#define nl cout<<"\n"
#define ll long long int
#define ull unsigned long long int
#define ld long double
#define mp(a,b) make_pair(a,b)
#define all(x) x.begin(),x.end()
#define pi pair < int,int >
#define pl pair < ll,ll >
#define vi vector<int>
#define vl vector<ll>
#define pb push_back
#define maxi 100005
#define MOD (1000000007LL)
#define INF 1e18
#define MAXI 1000005
#define ff first
#define blk 320
#define ss second
static int rowNbr[] = {-1, -1, -1,  0, 0,  1, 1, 1};
static int colNbr[] = {-1,  0,  1, -1, 1, -1, 0, 1};
int dx[] = {1, -1, 0, 0};
int dy[] = {0, 0, 1, -1};
#define pqDijkstra priority_queue<pi,vector<pi >, greater<pi > > pq;
ll power(ll base, ll p){
ll ans = 1;while(p){if(p&1)ans=(ans*base);base=(base*base);p/=2;}return ans;
}

ll modPower(ll base, ll p, ll mod){
ll ans = 1;while(p){if(p&1)ans=(ans*base)%mod;base=(base*base)%mod;p/=2;}return ans;
}
bool isMultSafeToDo(ll a, ll b){  /// INF is the maximum value variable can have ATQ.
    if (a <= (INF+b-1ll)/b)return true;
    return false;
}
ll gcd(ll a, ll b){
    if(b == 0)  return a;
    return gcd(b, a%b);
}
/////////////////////////////////////////////Solution From Here//////////////////////////////////////////////////////////


int n;
vector<ll> a[2];
ll dp[2][1000];
void solve() {
    cin >> n ;
    loop(i,0,n) {
        int x;
        cin >> x ;
        a[0].pb(x);
    }
    loop(i,0,n) {
        int x;
        cin >> x ;
        a[1].pb(x);
    }
    dp[0][0] = a[0][0];
    dp[1][0] = a[0][0] + a[1][0];
    loop(i,1,n) {
        dp[0][i] =a[0][i] + dp[0][i-1];
        dp[1][i] = a[1][i] + max(dp[0][i],dp[1][i-1]);
    }


    cout << dp[1][n-1];
    return ;


}


int main()
{
    SPEED;

                                   solve();



}









Measured memory_bytes: 256
#include <iostream>
using namespace std;
#define ll long long int

int main() {
    int a[7]={1,3,5,7,8,10,12};
    int b[1]={2};
    int c[4]={4,6,9,11};
    int x=0,y=0,z=0;
    int q1,q2;
    cin>>q1>>q2;
    for(int i=0;i<7;i++){
        if(a[i]==q1 || a[i]==q2)x=1;
    }
    if(b[0]==q1 || b[0]==q2)y=1;
    for(int i=0;i<4;i++){
        if(c[i]==q1 || c[i]==q2)z=1;
    }
    //check
    if(x+y+z==1)cout<<"Yes";
    else cout<<"No";
	return 0;
}

Measured memory_bytes: 256