akhauriyash/Code-Regression huggingface dataset:
package main

import (
	"fmt"
)

func main() {
	var n string
	fmt.Scan(&n)

	solve := func() string {
		for i := 0; i < 3; i++ {
			if n[i] == '7' {
				return "Yes"
			}
		}
		return "No"
	}()

	fmt.Println(solve)
}


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

typedef long long ll;

const int MAX_K = 100000;
ll K, A[MAX_K];

int main() {
  cin >> K;
  for (int i=0; i<K; i++) {
    cin >> A[K-i-1];
  }

  ll min = 2, max = 2;
  for (int i=0; i<K; i++) {
    max = A[i]*(max/A[i])+A[i]-1;
    min = A[i]*((min-1)/A[i])+A[i];
    
    // cout << min << " " << max << endl;
    if (max < min) {
      cout << "-1" << endl;
      return 0;
    }
  }

  cout << min << " " << max << endl;
  return 0;
}


Measured memory_bytes: 1024
#include <stdio.h>

int main(void)
{
    int x;
    int i = 1;

    do {
        scanf("%d", &x);
        if(x != 0) {
            printf("Case %d: %d\n", i, x);
            i++;
        }
    } while (x != 0);
    return 0;
}

Measured memory_bytes: 600
#include<stdio.h>
#include<stdbool.h>

int main(void){
        char s[10], c;
        int l = 0, i, cnt = 0;
        bool ok = true;
        while((c=getchar())!='\n') s[l++] = c;
        for(i=0; i<l; i++){
                if('a'<=s[i] && s[i]<='z') cnt++;
                else if(s[i]=='C'){
                        if(i<2 || l-2<i) ok = false;
                }
                else if(s[i]=='A'){
                        if(i!=0) ok = false;
                }
                else ok = false;
        }
        if(ok && cnt==l-2) puts("AC");
        else puts("WA");
        return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <string>
#include <vector>

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

using std::cin;
using std::cout;
using std::endl;
using std::string;
using std::vector;

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

  if (A == 1) A += 13;
  if (B == 1) B += 13;

  if (A == B) cout << "Draw" << endl;
  else if (A < B) cout << "Bob" << endl;
  else cout << "Alice" << endl;

  return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int K = sc.nextInt();
		int Q = sc.nextInt();
		int[] A =new int[Q];
		for(int i = 0;i < Q;i++) {
			A[i] = sc.nextInt();
		}
		sc.close();
		int[] point = new int[N];
		for(int i = 0;i < N;i++) {
			point[i] = K - Q;
		}
		for(int i = 0;i < Q;i++) {
			int j = A[i]-1;
			point[j]++;
		}
		for(int i = 0;i < N;i++) {
			System.out.println(point[i] > 0 ? "Yes" : "No");
		}
	}
}

Measured memory_bytes: 56856
/*input
3
*/
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace __gnu_pbds;
typedef long long ll;
typedef long double ld;
int main()
{
	ios_base::sync_with_stdio(false);
	ll S;
	cin >> S;
	ll x1 = (S - 1) / 1000000000 + 1;
	ll y2 = 1000000000;
	//x1*y2-y1*x2=S
	ll x2 = 1;
	ll y1 = (x1 * y2 - S) / x2;
	cout << "0 0 " << x1 << " " << y1 << " " << x2 << " " << y2 << "\n";
}

Measured memory_bytes: 256
class Problem
  attr_accessor :a, :b, :n, :m, :h, :w

  def initialize
    @n = gets.to_s.to_i
    @s = Array.new(n){ gets.chomp }
    @cnt = @s.map{|v|v[0]}.tally
  end

  def solve
    ans = 0
    %w(M A R C H).combination(3) do |a|
      begin
        ans += a.map{|v|@cnt[v]}.inject(1,:*)
      rescue
      end
    end
    ans
  end

  def show(ans)
    puts ans
  end
end

Problem.new.instance_eval do
  show(solve)
end


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

template <class T>
T root(std::vector<T>& v, T x) {
    return v[x] - x ? (v[x] = root(v, v[x])) : x;
}

template <class T>
bool same(std::vector<T>& v, T x, T y) { return root(v, x) == root(v, y); }

template <class T>
void unite(std::vector<T>& v, T x, T y) {
    x = root(v, x);
    y = root(v, y);
    if (x != y) v[x] = y;
}

int main() {
    long long n, m;
    std::cin >> n >> m;
    std::vector<int> p(n);
    std::vector<std::deque<int>> g(n);
    for (int i = 0; i < n; i++) p[i] = i;
    for (int i = 0; i < m; i++) {
        int a, b;
        std::cin >> a >> b; a--; b--;
        unite(p, a, b);
        g[a].push_back(b);
        g[b].push_back(a);
    }
    std::map<int, std::deque<int>> sub;
    for (int i = 0; i < n; i++) {
        sub[root(p, p[i])].push_back(i);
    }

    long long a = 0, b = 0, c = 0;
    std::vector<bool> done(n, false), color(n);
    for (auto& s : sub) {
        auto v = s.second;
        if (v.size() == 1) {
            b++;
            continue;
        }
        std::deque<int> q;
        q.push_back(v[0]);
        color[v[0]] = true;
        bool odd = false;
        while (!q.empty()) {
            auto curr = q.front();
            done[curr] = true;
            for (auto to : g[curr]) {
                if (done[to] && color[to] == color[curr]) {
                    odd = true;
                    // break;
                } else if (!done[to]) {
                    q.push_back(to);
                    color[to] = !color[curr];
                }
            }
            q.pop_front();
            // if (odd) break;
        }
        if (odd) a++;
        else c++;
    }
    // std::cout << a << " " << b << " " << c << std::endl;

    std::cout << (a * a + 2 * a * c + 2 * c * c + 2 * n * b - b * b) << std::endl;

    return 0;
}

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

typedef struct node_{
	struct node_* pred;
	struct node_* nxt;
	int data;
} Node;

class MyList{
private :
	Node * cursor;
public :
	MyList(){
		cursor = new Node;
		cursor->pred = NULL;
		cursor->nxt = NULL;
		cursor->data = 0;
	}
	~MyList();
	void insert(int x);
	void move(int d);
	void erase();
	void print();
};

MyList::~MyList(){
	while(1){
		if(cursor->nxt == NULL && cursor->pred == NULL){
			delete cursor;
			break;
		}
		if(cursor->nxt == NULL){
			cursor = cursor->pred;
		}
		erase();
	}
}

void MyList::insert(int x){
		Node * pre_n = new Node;
		pre_n->nxt = cursor;
		pre_n->data = x;
	if(cursor->pred == NULL){
		pre_n->pred = NULL;
		cursor->pred = pre_n;
	}
	else{
		pre_n->pred = cursor->pred;
		cursor->pred->nxt = pre_n;
		cursor->pred = pre_n;
	}
	move(-1);
}
void MyList::move(int d){
	if(d == 0){
		return;
	}
	else if (d > 0){
		if(cursor->nxt == NULL){
			return;
		}
		cursor = cursor->nxt;
		move(d-1);
	}
	else if (d < 0){
		if(cursor->pred == NULL){
			return;
		}
		cursor = cursor->pred;
		move(d+1);
	}
}
void MyList::erase(){
	if(cursor->nxt == NULL){ // point at END
		return;
	}
	if(cursor->pred == NULL){
		cursor = cursor->nxt;
		Node * tmp = cursor->pred;
		cursor->pred = NULL;
		delete tmp;
	}
	else{
		cursor->pred->nxt = cursor->nxt;
		cursor = cursor->nxt;
		Node * tmp = cursor->pred;
		cursor->pred = cursor->pred->pred;
		delete tmp;
	}
}

void MyList::print(){
	move(-100000000); // set begin
	if(cursor->nxt == NULL){
		return;
	}
	printf("%d\n",cursor->data);
	erase();
	print();
}

int main(){
	MyList ml;
	int q,num,x;
	cin >> q;
	for(int i = 0; i < q; i++){
		cin >> num;
		if(num == 0){
			cin >> x;
			ml.insert(x);
		}
		else if (num == 1){
			cin >> x;
			ml.move(x);
		}
		else if (num == 2){
			ml.erase();
		}
	}
	ml.print();
	return 0;
}



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

int main() {
	string s, t;
	cin >> s >> t;
	vector<int> S(26, 0), T(26, 0);
	for (int i = 0; i < s.size(); i++)
		S[s[i] - 97]++;
	for (int i = 0; i < t.size(); i++)
		T[t[i] - 97]++;
	sort(S.begin(), S.end());
	sort(T.begin(), T.end());
	if (S == T)
		cout << "Yes" << endl;
	else
		cout << "No" << endl;
	return 0;
}


Measured memory_bytes: 776
#include<stdio.h>
#include <string.h>
 
int main() {
    int count = 0;
    int len;
    char str1[256], rev[256];
    scanf("%s", str1);
    for(len = 0; str1[len]!='\0'; ++len);

    for(int j=0; j<len; j++){
        rev[j] = str1[len-1-j];
    }
    for (int i = 0; i < len / 2; i++)
    {
        if(str1[i] != rev[i]){
            count++;
            }
    }
    printf("%d", count);
    return 0;
}

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

bool compare(string a,string b)
{
    int n=a.size();
    for(int i=0; i<a.size(); i++)
    {
        if(a[i]<b[i]) return a[i]<b[i];
        else if(a[i]==b[i]) continue;
    }
    return a[n-1]<=b[n-1];
}

int main()
{
    int n,k,a[10]={0},b,ans;
    cin>>n>>k;
    for(int i=0; i<k; i++)
    {
        cin>>b;
        a[b]=1;
    }
    int limit=n+1e6;
    for(int i=n; i<=limit; i++)
    {
        int c=i,d=1;
        while(c>0)
        {
            int x=c%10;
            c/=10;
            if(!a[x]) continue;
            else d=0;
        }
        if(d)
        {
            ans=i;
            break;
        }
    }
    cout<<ans<<endl;
    return 0;
}



Measured memory_bytes: 256
import java.util.*;
import java.io.*;

public class Main {
	private static void solve(){
		//Implement solution here.
		String s = next();
		int result = 0;
		if(("SUN").equals(s)) {
			result = 7;
		} else if(("MON").equals(s)) {
			result = 6;
		} else if(("TUE").equals(s)) {
			result = 5;
		} else if(("WED").equals(s)) {
			result = 4;
		} else if(("THU").equals(s)) {
			result = 3;
		} else if(("FRI").equals(s)) {
			result = 2;
		} else if(("SAT").equals(s)) {
			result = 1;
		} 
				
		System.out.println(result);
	}
	
	private static int dfs(int dig, int cur, int max) {
		int result = 0;	
		if(dig >= 3) {
			if(dig <= Integer.toString(max).length()) {
				if(cur <= max) {
					if(is753(cur))result++;
				} else {
					return 0;
				}
			} else {
				return 0;
			}
		}	
		dig++;
		result += dfs(dig, cur * 10 + 3, max) + dfs(dig, cur * 10 + 5, max) + dfs(dig, cur * 10 + 7, max);
		return result;
	}

	private static boolean is753(int in) {
		boolean[] flags = new boolean[3];
		char[] inca = Integer.toString(in).toCharArray();
		for(char c:inca) {
			if(c == '3')flags[0] = true;
			if(c == '5')flags[1] = true;
			if(c == '7')flags[2] = true;
		}
		
		return flags[0] && flags[1] && flags[2];
	}
	//Switch input source (stdin/file)
	private static Scanner scanner = new Scanner(System.in);
	public static void main(String[] args){
		String debugDataPath = System.getenv("DD_PATH");        
		if(debugDataPath != null){
			try{
				scanner = new Scanner(new BufferedReader(new InputStreamReader(new FileInputStream(new File(debugDataPath)))));
			}catch(Exception e){
				throw new RuntimeException(e);
			}
		}
		solve();
	}

	//Input read utility
	private static StringTokenizer tokenizer = null;
	public static String next() {
		while (tokenizer == null || !tokenizer.hasMoreTokens()) {
			try {
				tokenizer = new StringTokenizer(scanner.nextLine());
			} catch (Exception e) {
				throw new RuntimeException(e);
			}
		}
		return tokenizer.nextToken();
	}
	//Get next single int
	private static int ni() {
		return Integer.parseInt(next());
	}
	//Get next single long
	private static long nl() {
		return Long.parseLong(next());
	}
	//Get next single double
	private static double nd() {
		return Double.parseDouble(next());
	}
	//Get next int array from one line
	private static int[] na(int n) {
		int[] a = new int[n];
		for (int i = 0; i < n; i++)
			a[i] = ni();
		return a;
	}
	//Get next char array from one line
	private static char[] ns() {
		return next().toCharArray();
	}
	//Get next long array from one line
	private static long[] nal(int n) {
		long[] a = new long[n];
		for (int i = 0; i < n; i++)
			a[i] = nl();
		return a;
	}
}

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

int main(){
  int N;
  string S;
  cin >> N >> S;
  int ans=0;
  for(int i=0; i<N; i++){
    vector<int> A(26);
    vector<int> B(26);
    int ant=0;
    for(int j=0; j<=i; j++) A.at(S.at(j)-97)++;
    for(int j=i+1; j<N; j++) B.at(S.at(j)-97)++;
    for(int i=0; i<26; i++){
      if(A.at(i)>0 && B.at(i)>0) ant++;
    }
    ans = max(ans, ant);
  }
  cout << ans << endl;
}

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

public class Program
{

    public void Proc()
    {
        int len = int.Parse(Reader.ReadLine());

        items = Reader.ReadLine().Split(' ').Select(a => int.Parse(a)).ToArray();

        int[] idxs = new int[len];
        int[] subtotal = new int[len];
        long ans = 0;
        for (int i = 0; i < len; i++) {
            if(i==0) {
                idxs[i] = i;
                subtotal[i] = items[i];
            } else {
                idxs[i] = idxs[i - 1];
                subtotal[i] = subtotal[i - 1] - items[i - 1];
            }

            for (int j = idxs[i] + 1; j < len; j++) {
                int sum = subtotal[i] + items[j];
                int xor = subtotal[i] ^ items[j];
                if(sum!=xor) {
                    break;
                }
                idxs[i] = j;
                subtotal[i] = sum;
            }
            ans += (idxs[i] - i + 1);
        }
        Console.WriteLine(ans);
    }

    private int[] items;

    private Dictionary<int, Dictionary<int, long>> dic = new Dictionary<int, Dictionary<int, long>>();

	public class Reader
    {
        static StringReader sr;
        public static bool IsDebug = false;
        public static string ReadLine()
        {
            if (IsDebug)
            {
                if (sr == null)
                {
                    sr = new StringReader(InputText.Trim());
                }
                return sr.ReadLine();
            }
            else
            {
                return Console.ReadLine();
            }
        }
        private static string InputText = @"



19
885 8 1 128 83 32 256 206 639 16 4 128 689 32 8 64 885 969 1
";
    }

    public static void Main(string[] args)
    {
#if DEBUG
        Reader.IsDebug = true;
#endif
        Program prg = new Program();
        prg.Proc();
    }
}

Measured memory_bytes: 35668
#include<bits/stdc++.h>
using namespace std;
int main() {
  struct Edge {int from, to; double weight;};
  typedef vector<vector<Edge>> Graph;
  // Input
  int N, M, K;
  cin >> N >> M >> K;
  Graph G(N);
  for(int i = 0; i < M; ++i) {
    int a, b;
    double l;
    cin >> a >> b >> l;
    --a; --b;
    G[a].push_back({a, b, l});
    G[b].push_back({b, a, l});
  }
  set<int> store;
  for(int i = 0; i < K; ++i) {
    int s;
    cin >> s;
    store.insert(s - 1);
  }
  // Dijkstra
  vector<int> distance(N, -1);
  priority_queue<Edge, vector<Edge>, function<bool(Edge, Edge)>> q([](Edge lhs, Edge rhs) {
    if(lhs.weight != rhs.weight) return lhs.weight > rhs.weight;
    return lhs.from != rhs.from ? lhs.from < rhs.from : lhs.to < rhs.to;
  });
  for(auto i: store) q.push({i, i, 0});
  while(!q.empty()) {
    auto e = q.top();
    q.pop();
    if(distance[e.to] != -1) continue;
    distance[e.to] = e.weight;
    for(const auto& next: G[e.to]) if(distance[next.to] == -1) q.push({next.from, next.to, e.weight + next.weight});
  }
  // Output
  double answer = 0;
  for(const auto& list: G) for(const auto e: list) if(e.from < e.to) {
    answer = max(answer, (distance[e.from] + distance[e.to] + e.weight));
  }
  cout << (int) (answer / 2.0 + 0.5) << endl;
}

Measured memory_bytes: 8796
#include <iostream>
#include <stdio.h>
#include <string.h>
#include <vector>
#include <algorithm>
#include <sstream>
#include <cstdlib>

using namespace std;

int main()
{
   long k, n;
   cin>>k>>n;
   vector<long> a(n+1), b(n);
   for(long i=0; i<n; i++){cin>>a[i];}
   a[n]=a[0]+k;
   for(long i=0; i<n; i++){
      b[i]=(a[i+1]-a[i]);
   }
   sort(b.begin(), b.end());
   cout<<k-b[n-1]<<endl;
}


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

#define FOR(i,l,r) for(int i = (l);i < (r);i++)
#define ALL(x) (x).begin(),(x).end()
template<typename T> bool chmax(T& a,const T& b){return a < b ? (a = b,true) : false;}
template<typename T> bool chmin(T& a,const T& b){return b < a ? (a = b,true) : false;}
typedef long long ll;

ll N,T;
const ll INF = 1e9;

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

	cin >> N >> T;
	vector<ll> A(N);
	FOR(i,0,N){
		cin >> A [i];
	}

	ll mn = INF;
	ll mx = 0,mx_cnt = 0;
	FOR(i,0,N){
		if((A [i] - mn) * T == mx){
			mx_cnt++;
		}
		else if((A [i] - mn) * T > mx){
			mx = (A [i] - mn) * T;
			mx_cnt = 1;
		}
		chmin(mn,A [i]);
	}

	cout << mx_cnt << endl;

	return 0;
}


Measured memory_bytes: 1024
from heapq import heappush, heappop, heapify
from collections import deque, defaultdict, Counter
import itertools
from itertools import permutations, combinations, accumulate
import sys
import bisect
import string
import math
import time


def I(): return int(input())


def S(): return input()


def MI(): return map(int, input().split())


def MS(): return map(str, input().split())


def LI(): return [int(i) for i in input().split()]


def LI_(): return [int(i)-1 for i in input().split()]


def StoI(): return [ord(i)-97 for i in input()]


def ItoS(nn): return chr(nn+97)


def input(): return sys.stdin.readline().rstrip()


def debug(table, *args):
    ret = []
    for name, val in table.items():
        if val in args:
            ret.append('{}: {}'.format(name, val))
    print(' | '.join(ret), file=sys.stderr)


yn = {False: 'No', True: 'Yes'}
YN = {False: 'NO', True: 'YES'}
MOD = 10**9+7
inf = float('inf')
IINF = 10**19
l_alp = string.ascii_lowercase
u_alp = string.ascii_uppercase
ts = time.time()
sys.setrecursionlimit(10**6)
nums = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10']

show_flg = False
# show_flg = True


def c(i, j, k):
    return j - i != k - j


def main():
    N = I()
    s = S()
    r, g, b = 0, 0, 0

    for i in range(N):
        if s[i] == 'R':
            r += 1
        elif s[i] == 'G':
            g += 1
        else:
            b += 1

    all_c = r * g * b
    sub = 0
    test = 0

    for i in range(N):
        for j in range(i+1, N):
            k = (j - i) + j
            if k >= N or s[i] == s[j] or s[k] == s[i] or s[j] == s[k]:
                continue
            # 全部異なる、等差である
            sub += 1

    # 全部異なる、等差でないを求める
    print(all_c - sub)


if __name__ == '__main__':
    main()


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

#include <math.h>
#include <stdlib.h>


#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;

template<class T> inline bool chmin(T &a, T b) { if(a > b){ a = b; return true; } return false; }
template<class T> inline bool chmax(T &a, T b) { if(a < b){ a = b; return true; } return false; }

// const int INF = 1001001001;
// long long max => LLONG_MAX

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    
    int n; string s;
    cin >> n >> s;

    set<int> d1;
    set<int> d2;
    set<int> d3;
    int x1 = int(s[0] - '0');
    int x2 = int(s[1] - '0');
    d1.insert(x1);
    d1.insert(x2);
    d2.insert(x1 * 10 + x2);

    for(int i = 2; i < n; i++){
        int x = int(s[i] - '0');
        for(int p : d2){
            d3.insert(p * 10 + x);
        }

        for(int p : d1){
            d2.insert(p * 10 + x);
        }

        d1.insert(x);
    }

    cout << d3.size() << endl;

    return 0;
}


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

int main() {
  int N;
  cin >>N;
  int TOTAL = 0;
    
  vector<int> V(N);
    for (int i = 0; i < N; i++) 
    cin >> V.at(i);
  vector<int> C(N);
    for (int i = 0; i < N; i++) {
    cin >> C.at(i);      
      if (V.at(i) > C.at(i))
        TOTAL += (V.at(i) - C.at(i));
     } 
      
  cout << TOTAL << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 1e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;

int main(){
	cin.tie(0);
   	ios::sync_with_stdio(false);
	
	int a, b, c;
	cin >> a >> b >> c;
	if((a < c && c < b) || (b < c && c < a))
		cout << "Yes" << '\n';
	else
		cout << "No" << '\n';
 
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <vector>
#include <map>
#include <unordered_map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <math.h>
#include <sstream>
#include <numeric>
#include <string>
#include <cassert>
#include <bitset>

using namespace std;
typedef long long ll;

int main() {
  int N;
  cin >> N;
  vector<int> A(N);
  vector<vector<int> > X(N);
  vector<vector<int> > Y(N);
  for (int i = 0; i < N; ++i) {
    cin >> A[i];
    X[i] = vector<int>(A[i]);
    Y[i] = vector<int>(A[i]);    
    for (int j = 0; j < A[i]; ++j) {
      cin >> X[i][j] >> Y[i][j];
      --X[i][j];
    }
  }

  int max_cnt = 0;
  for (int k = 0; k < (1<<N); ++k) {
    vector<int> B(N);
    for (int i = 0; i < N; ++i) {
      if (((k>>i) & 1) == 0) B[i] = 0;
      else B[i] = 1;
    }
    bool valid = true;
    for (int i = 0; i < N; ++i) {
      if (B[i] == 0) continue;
      for (int j = 0; j < A[i]; ++j) {
	if (B[X[i][j]] != Y[i][j]) {
	  valid = false;
	  break;
	}
      }
    }

    if (valid) {
      int cnt = 0;
      for (int i = 0; i < N; ++i) {
	if (B[i] == 1) ++cnt;
      }
      max_cnt = max(max_cnt, cnt);
    }
  }

  cout << max_cnt << endl;
  
  return 0;
}


Measured memory_bytes: 256
N = int(input())

lst = list(map(int, input().split()))
lst.insert(0,0)
lst.insert(len(lst),0)

money = 0
for i in range(N+1):
  money += abs(lst[i+1] - lst[i])

for i in range(1,N+1):
  a = lst[i-1]
  b = lst[i]
  c = lst[i+1]
  if (a <= b and b <= c or a >= b and b >= c):
    print(money)
  elif (a <= c and c <= b):
    print(money - abs(2 * (c - b)))
  elif (b <= a and a <= c):
    print(money - abs(2 * (a - b)))
  elif (b <= c and c <= a):
    print(money - abs(2 * (b - c)))
  elif (c <= a and a <= b):
    print(money - abs(2 * (a - b)))

Measured memory_bytes: 13920
#define _USE_MATH_DEFINES
#define _CRT_SECURE_NO_WARNINGS
#include <bits/stdc++.h>
using namespace std;

//
#define int long long
#define pb(x) push_back(x)
#define m0(x) memset((x), 0, sizeof(x))
#define mm(x) memset((x), -1, sizeof(x))

//container
#define ALL(x) (x).begin(), (x).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define EACH(i, c) for (typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i)
#define EXIST(s, e) ((s).find(e) != (s).end())
#define UNIQUE(v) (v).erase(unique((v).begin(), (v).end()), (v).end());
#define PERM(c) \
  sort(ALL(c)); \
  for (bool c##p = 1; c##p; c##p = next_permutation(ALL(c)))

// debug
#define GET_VAR_NAME(variable) #variable
#define test(x) cout << GET_VAR_NAME(x) << " = " << x << endl;

// bit_macro
#define bit(n) (1LL << (n))
#define bitset(a, b) (a) |= (1 << (b))
#define bitunset(a, b) (a) |= ~(1 << (b))
#define bitcheck(a, b) ((((a) >> (b)) & 1) == 1)
#define bitcount(a) __builtin_popcountll((a))

//typedef
typedef long long lint;
typedef unsigned long long ull;
typedef complex<long double> Complex;
typedef pair<int, int> P;
typedef tuple<int, int, int> TP;
typedef vector<int> vec;
typedef vector<vec> mat;

//constant
const int INF = (int)1e18;
const int MOD = (int)1e9 + 7;
const double EPS = (double)1e-10;
const int dx[] = {-1, 0, 0, 1, 0, -1, -1, 1, 1};
const int dy[] = {0, -1, 1, 0, 0, 1, -1, 1, -1};

//
template <typename T>
void chmax(T &a, T b) { a = max(a, b); }
template <typename T>
void chmin(T &a, T b) { a = min(a, b); }
//
inline int toInt(string s) {
  int v;
  istringstream sin(s);
  sin >> v;
  return v;
}
template <class T>
inline string toString(T x) {
  ostringstream sout;
  sout << x;
  return sout.str();
}

//
struct Accelerate_Cin {
  Accelerate_Cin() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout << fixed << setprecision(20);
  };
};

int N;
vec a;

int dp[3030][3030];
bool flag[3030][3030];

int rec(int l, int r, int turn) {
  if (flag[l][r]) return dp[l][r];
  if (r < l || r == -1 || l == N) return 0;

  int res;
  if (turn == 0) {
    res = max(rec(l, r - 1, (turn + 1) % 2) + a[r], rec(l + 1, r, (turn + 1) % 2) + a[l]);
  } else {
    res = min(rec(l, r - 1, (turn + 1) % 2) - a[r], rec(l + 1, r, (turn + 1) % 2) - a[l]);
  }

  flag[l][r] = true;
  return dp[l][r] = res;
}

signed main() {
  cin >> N;
  for (int i = 0; i < N; i++) {
    int tmp;
    cin >> tmp;
    a.pb(tmp);
  }

  m0(flag);

  cout << rec(0, N - 1, 0) << endl;
  return 0;
}


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

# define Rep(i,a,b) for(int i=a;i<=b;i++)
# define _Rep(i,a,b) for(int i=a;i>=b;i--)
# define RepG(i,u) for(int i=head[u];~i;i=e[i].next)

typedef long long ll;

const int N=1e5+5;

template<typename T> void read(T &x){
   x=0;int f=1;
   char c=getchar();
   for(;!isdigit(c);c=getchar())if(c=='-')f=-1;
   for(;isdigit(c);c=getchar())x=(x<<1)+(x<<3)+c-'0';
    x*=f;
}

int n,k;
int a[N];
int ans;

int main()
{
    read(n),read(k);
    Rep(i,1,n)read(a[i]);
    sort(a+1,a+n+1);
    Rep(i,1,k)ans+=a[i];
    printf("%d\n",ans);
    return 0;
}

Measured memory_bytes: 3760
//#include <fsociety>
#include <cmath>
#include <deque>
#include <algorithm>
#include <iterator>
#include <list>
#include <map>
#include <unordered_map>
#include <queue>
#include <set>
#include <unordered_set>
#include <stack>
#include <string>
#include <vector>
#include <fstream>
#include <iostream>
#include <stdio.h>
//end of libraries ;
//freopen("input.txt","r",stdin);
//freopen("output.txt","w",stdout);
// ll lmax(ll o , ll w) {if(o>w)return o; return w;}
// ll lmin(ll o , ll w) {if(o<w)return o; return w;}
#define INF 3999999999999999999
#define N 3000003
#define PI 3.14159265359
#define F first
#define S second
#define pb push_back
#define ll long long
#define fcin ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);
using namespace std;
ll a , b , c , d;
int main(){
	cin >> a >> b >> c >> d;
	if(d < a) cout<<d<<endl;
	else{
	d -= a;
	d -= b;
	if(d > 0){
		cout << a - d << endl;
		}
	else cout << a << endl;
	}
}

Measured memory_bytes: 3188
#include<iostream>
#include<vector>

using namespace std;

int f(int n){
    int cnt = 0;
    for(int i = 1; i <= n; i++){
        if(n % i == 0) cnt++;
    }
    return cnt;
}

int main(){
    
    int n;
    int cnt = 0;

    cin >> n;

    for(int i = 1; i <= n; i++){
        if(f(i) == 8 && i % 2 == 1){
            cnt++;
        }
    }

    cout << cnt << endl;
    
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <vector>
#include <utility>
#include <string>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <string.h>
#include <deque>
#include <stack>
#include <queue>
#include <list>
#include <map>
#define REP(i,j,n) for(int i=j;i<n;i++)
#define SORT(x) sort(x.begin(),x.end())

using namespace std;

int main(void){
	int n, k, x,sum=0;
	cin >> n >> k;
	for (int i = 0; i < n; i++) {
		cin >> x;
		if (x < k - x) sum += x * 2;
		else sum += (k - x) * 2;

	}
	cout << sum << endl;
	return 0;
}

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

int main(void)
{
    int a, b, c;

    cin >> a >> b >> c;
    if (a < b && b < c)
    {
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 3104
module Factwithmod
  implicit none
  integer(16),allocatable,dimension(:)::Kaijo,comb
  contains
subroutine initiationFactorial(maxnum,mo)
  implicit none
  integer(16)::maxnum
  integer(16)::mo
  integer(16)::i

  allocate(Kaijo(0:maxnum))
  Kaijo(0)=1
  do i=1,maxnum
    Kaijo(i)=mod(Kaijo(i-1)*i,mo)
  end do
end subroutine

subroutine combination(n,maxnum,l)
implicit none
integer(16),intent(in)::n,maxnum,l
integer(16)::i
allocate(comb(maxnum))
comb(1)=N
do i=2,maxnum
    comb(i)=comb(i-1)*(N-i+1)*inv(i,l)
    comb(i)=mod(comb(i),l)
end do
end subroutine

function inv(K,L)
integer(16),intent(in)::k,l
integer(16) l2,y
integer(16) inv
inv=1
l2=l-2
y=k
do
  if(mod(l2,2)==1)inv=mod(inv*y,l)
  y=mod(y*y,l)
  l2=l2/2
  if(l2==0)exit
end do
end function

function permutation(n,k,mo)
implicit none
  integer(16)::n,k
  integer(16)::mo,permutation
  permutation=mod(Kaijo(N)*inv(Kaijo(N-K),mo),mo)
end function
end module Factwithmod
program ABC156b
    use Factwithmod
    implicit none
    integer(16)::N
    integer(16)::a,b
    integer(16)::mo=10**9+7
    integer(16)::allc
    integer(16)::ans
    read*,N,a,b
    call combination(N,b,mo)
    allc=power_func(2_16,N,mo)-1_16
    ans=allc-comb(a)-comb(b)
    ans=mod(ans,mo)
    if(ans<0)ans=ans+mo
    print"(i0)",ans
contains
integer(16) function power_func(a,n,mo)
    integer(16)::a,n,mo
    integer(16)::l2,y
    power_func=1
    l2=N
    y=a
    do
        if(mod(l2,2)==1)power_func=mod(power_func*y,mo)
        y=mod(y*y,mo)
        l2=l2/2
        if(l2==0)exit
    end do
end function power_func
end program ABC156b

Measured memory_bytes: 3328
#include<stdio.h>

int main(){
  int a,b,buf;
  
  scanf("%d%d", &a, &b);
  
  if(a >= b){
    while((buf = a % b) != 0){
      a = b;
      b = buf;
    }
    printf("%d\n", b);
  }
  else
    {
      while((buf = b % a) != 0){
	b = a;
	a = buf;
      }
      printf("%d\n", a);
    }
  
  return 0;
}

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

#define rep(i, n) REP(i, 0, n)
#define repr(i, n) for (int i = (n); i >= 0; i--)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for (int i = x; i < n; i++)
#define OP(m) cout << m << endl
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

int main()
{
    int a, b;
    cin >> a >> b;
    rep(i, 20000)
    {
        double c = i;
        if (floor(i * 0.08) == a && floor(i * 0.1) == b)
        {
            OP(i);
            return 0;
        }
    }
    OP(-1);
    return 0;
}

Measured memory_bytes: 256
/*
 this->author = Fuad Ashraful Mehmet, CSE-UAP
  ToDo--
  uva 1223
*/
#include<bits/stdc++.h>
#define forn(i,n) for(int i=0;i<(int)n;++i)
#define all(o) (o).begin(),(o).end()
#define dbg(o)  cerr<<"at "<<__LINE__<<" response = "<<o<<endl;
using namespace std;

/*
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
#define ordered_multiset tree<pair<int, int>, null_type,less<pair<int, int> >, rb_tree_tag,tree_order_statistics_node_update>
*/

const int N=2e5+5;
typedef long long ll;
int n,m;
string s;
ll a[2][N]; // idx 0 for up and 1 for down
ll tree[2][N*4];
int res[N];

ll bigMod(ll b,ll p,ll mod)
{
      if(p==0)return 1LL;
      if(p&1) return (b*bigMod(b,p-1,mod)%mod);
      
      ll r=bigMod(b,p>>1,mod)%mod;
      return (r*r)%mod;
}
void calMod(int idx,int mod)
{
      for(int i=0;i<n;++i)
      {
            if(s[i]=='0')continue;
            a[idx][i+1]=bigMod(2,i,mod);
      }
}// end func


void buildTree(int idx,int l,int r,ll mod,int nd=1)
{
      if(l==r)
      {
            tree[idx][nd]=a[idx][l];
            return;
      }

      int mid=(l+r)>>1;
      buildTree(idx,l,mid,mod,nd<<1);
      buildTree(idx,mid+1,r,mod,nd<<1|1);
      tree[idx][nd]=(tree[idx][nd<<1]+tree[idx][nd<<1|1])%mod;
      return;
}

ll query(int idx,int l,int r,int x,int y,ll mod,int nd=1)
{
      if(x>y)return 0LL;
      if(l>y or r<x)return 0LL;
      if(l>=x and r<=y)
      {
            return tree[idx][nd];
      }
      int mid=(l+r)>>1;

      ll r1=query(idx,l,mid,x,y,mod,nd<<1)%mod;
      ll r2=query(idx,mid+1,r,x,y,mod,nd<<1|1)%mod;
      return (r1+r2)%mod;
}

int find_ans(int num)
{
      int cnt=0;
      while(num>0)
      {
            cnt++;
            int bit=__builtin_popcount(num);
            num=num%bit;
      }
      return cnt;
}
void HalfDead()
{
      cin>>n;
      cin>>s;
      int cnt=0;
      for(int i=0;i<n;++i)
      {
            cnt+=(s[i]=='1');
      }
      int up=cnt+1;
      int down=cnt-1;
      reverse(all(s));
      calMod(0,up);
      buildTree(0,1,n,up);
      if(down>0)
      {
            calMod(1,down); 
            buildTree(1,1,n,down);
      }

      for(int i=0;i<n;++i)
      {
            if(s[i]=='1') // one means take down answer
            {
                  if(down==0)
                  {
                        res[i+1]=-1;
                        continue;
                  }
                  ll ret=(query(1,1,n,1,i,down)+query(1,1,n,i+2,n,down))%down;
                  res[i+1]=find_ans(ret);
            }
            else
            {
                  ll ret=(query(0,1,n,1,i,up)+query(0,1,n,i+2,n,up)+bigMod(2,i,up))%up;
                  res[i+1]=find_ans(ret);      
            }
            
      }

      for(int i=n;i>=1;--i)
      {
            cout<<res[i]+1<<endl;
      }
      return;
}
int main()
{
      ios_base::sync_with_stdio(0); cin.tie(nullptr);
      int tc=1;
     // cin>>tc;
      while(tc--)
      HalfDead();
      return 0;
}

Measured memory_bytes: 15780
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0; i<(n); i++)
int main() {
  int h, w;
  cin >> h >> w;
  vector<vector<char>> grid(h, vector<char>(w));
  for(int i=0; i<h; i++){
    for(int j=0; j<w; j++){
      cin >> grid[i][j];
    }
  }
  for(int i=0; i<h; i++){
    for(int j=0; j<w; j++){
      if(grid[i][j]=='#'){
        if(i==0 && j==0){
          if(grid[i+1][j]=='#' || grid[i][j+1]=='#'){
            continue;
          }
        }
        if(i==0 && j==w-1){
          if(grid[i+1][j]=='#' || grid[i][j-1]=='#'){
            continue;
          }
        }
        if(i==0 && j>0 && j<w-1){
          if(grid[i+1][j]=='#' || grid[i][j+1]=='#' || grid[i][j-1]=='#'){
            continue;
          }
        }
        if(i==h-1 && j==0){
          if(grid[i-1][j]=='#' || grid[i][j+1]=='#'){
            continue;
          }
        }
        if(i==h-1 && j==w-1){
          if(grid[i-1][j]=='#' || grid[i][j-1]=='#'){
            continue;
          }
        }
        if(i==h-1 && j>0 && j<w-1){
          if(grid[i-1][j]=='#' || grid[i][j+1]=='#' || grid[i][j-1]=='#'){
            continue;
          }
        }
        if(j==0 && i>0 && i<h-1){
          if(grid[i+1][j]=='#' || grid[i-1][j]=='#' || grid[i][j+1]=='#'){
            continue;
          }
        }
        if(j==w-1 && i>0 && i<h-1){
          if(grid[i+1][j]=='#' || grid[i-1][j]=='#' || grid[i][j-1]=='#'){
            continue;
          }
        }
        if(i>0 && i<h-1 && j>0 && j<w-1){
          if(grid[i+1][j]=='#' || grid[i-1][j]=='#' || grid[i][j+1]=='#' || grid[i][j-1]=='#'){
            continue;
          }
        }
        cout << "No" << endl;
        return 0;
      }
    }
  }
  cout << "Yes" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

#define itr(a) begin(a), end(a)
#define pb push_back
#define x first
#define y second
#define endl '\n'

#define FAST cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);

#ifndef __LOCAL
#define FILES(namein, nameout) freopen(namein, "r", stdin); freopen(nameout, "w", stdout); FAST;
#else
#define FILES(namein, nameout) FAST;
#endif //__LOCAL

using namespace std;
using namespace __gnu_pbds;
using python = void;

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef unsigned short uss;
typedef pair<ll, ll> pll;
typedef tree<ll, null_type> ordered_set;

const ll M = 1e9+7;
const ll N = 1e4+228;
constexpr ll inf = 0x3f3f3f3f3f3f3f3f;

map<ll, ll> nsk;
void factnsk(ll n){
	ll on = n;
	for(ll i = 2;i*i<=n;i++){
		ll c=  0;
		while(on%i == 0){
			on /= i;
			++c;
		}
		if(c !=0) nsk[i] = max(nsk[i], c);
	}
	if(on > 1) nsk[on] = max<ll>(nsk[on], 1);
}

ll bpm(ll a, ll b){
	if(b == 0) return 1;
	if(b == 1) return a;
	ll x = bpm((a*a)%M, b/2);
	if(b&1) x = (x*a)%M;
	return x;
}

ll a[N];

python solve(){
	FAST;
	ll n;
	cin >> n;
	for(ll i =0;i<n;i++){
		cin >> a[i];
		factnsk(a[i]);
	}
	ll xk = 1;
	for(auto i : nsk){
		xk = (xk*bpm(i.x, i.y))%M;
	}
	ll res = 0;
	for(ll i =0;i<n;i++){
		res = (res+(xk*bpm(a[i], M-2))%M)%M;
	}
	cout << res << '\x0a';
}

signed main(){
	FAST;
	ll q = 1;
	//cin >> q;
	while(q--){
		solve();
	}
}

Measured memory_bytes: 1024
#include <stdio.h>

int main(void) {
	int i,j,n,m,t,s[32768],p,ans;
	for(i = 0;i <= 32768;i++){s[i] = 1;}
	scanf("%d%d%d",&n,&m,&t);
	for(i = 1;i <= n;i++){
		scanf("%d",&p);
		for(j = p-m;j < p+m;j++){
			s[j] = 0;
		}
	}
	for(i = 0;i < t;i++){
		ans+=s[i];
	}
	printf("%d\n",ans);
	return 0;
}

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

#define For(i, j, k) for (int i = j; i <= k; i++)

using namespace std;

const int N = 18;

int A[1 << N], ans[1 << N];
int n;

int main() {

	scanf("%d", &n);
	For(i, 0, (1 << n) - 1) scanf("%d", &A[i]);
	For(i, 0, n - 1) For(j, 0, (1 << n) - 1)
		if (j & (1 << i)) {
			ans[j] = max(ans[j], A[j ^ (1 << i)] + A[j]);
			A[j] = max(A[j], A[j ^ (1 << i)]);
		}
	For(i, 1, (1 << n) - 1) ans[i] = max(ans[i], ans[i - 1]);
	For(i, 1, (1 << n) - 1) printf("%d\n", ans[i]);

	return 0;
}

Measured memory_bytes: 5120
from collections import Counter
N = int(input())
A = list(map(int, input().split()))
C = Counter(A)

A = set(A)
MAX_A = 10 ** 6
X = [0] * (MAX_A + 1)
for a in A:
    for i in range(a, MAX_A + 1, a):
        X[i] += 1

ans = len([a for a in A if (X[a] == 1) and (C[a] == 1)])
print(ans)


Measured memory_bytes: 51080
package main

import "fmt"

func main(){
	var a,b,c,k,i int
	var ans bool
	ans = true
	fmt.Scan(&a,&b,&c)
	fmt.Scan(&k)
	for i=0;;i++ {
		if a < b {
			break
		}
		if i == k {
			ans = false
		}
		b *= 2
	}
	for ;; i++ {
		if b < c {
			break
		}
		if i == k {
			ans = false
		}
		c *= 2
	}
	if ans {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}


Measured memory_bytes: 1768
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define All(a) a.begin(),a.end()
#define INF 1000000007
const int MOD = 1000000007;
//accumulate(vec.begin(), vec.end(), 0)

int gcd(int x,int y){
  if(x%y==0) return y;
  else return gcd(y,x%y);
}

int main(){
  string s;
  cin >> s;
  if(s=="ABC") cout<< "ARC" <<endl;
  else cout<< "ABC" <<endl;
}


Measured memory_bytes: 3600
#include <stdio.h>
#include <iostream>
#include <queue>
#include <cstdio>
#include <stack>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <string.h>
#include <limits.h>
#include <map>
#include <string>
#include <bitset>
#include <vector>
using namespace std;
int cnt[2005],l[2005];
bool cmp(int a,int b)
{
    return a<b;
}
int main() {
    int n,ans=0;
    cin>>n;
    for(int i=1;i<=n;i++) cin>>l[i];
    sort(l+1,l+n+1,cmp);
    cnt[l[1]+l[2]]++;
    for(int i=3;i<=n;i++)
    {
        for(int j=l[i]+1;j<=2000;j++) ans+=cnt[j];
        for(int j=1;j<i;j++) cnt[l[j]+l[i]]++;
    }
    printf("%d\n",ans);
}


Measured memory_bytes: 3676
package main

import (
	"fmt"
	"math"
)

func intMin(x, y int) int {
	return int(math.Min(float64(x), float64(y)))
}

func main() {
	var S string
	fmt.Scan(&S)

	cnt := []int{0, 0}
	for i, rn := range S {
		s := string(rn)
		if s == "0" {
			cnt[-(i%2-1)]++
		} else {
			cnt[i%2]++
		}
	}

	fmt.Println(intMin(cnt[0], cnt[1]))
}


Measured memory_bytes: 1280
#include <iostream>
#include <queue>

using namespace std;

int main(){
	queue<int> data;
	double bmi;
	double weight,height;
	char tmp;
	int num;
	while(cin>>num){
	//	if(num==0)break;
		cin>>tmp;
		cin>>weight;
		cin>>tmp;
		cin>>height;

		bmi = weight/(height*height);

		if(bmi >= 25.0){
			data.push(num);
		}
	}
	int size = data.size();
	for(int i=0;i<size;i++){
		cout<<data.front()<<endl;
		data.pop();
	}

	return 0;
}
/*
Sample Input
1001,50.0,1.60 
1002,60.0,1.70 
1003,70.0,1.80 
1004,80.0,1.70 
1005,90.0,1.60 
Output for the Sample Input
1004
1005 
*/

Measured memory_bytes: 1236
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define pb push_back
#define mp make_pair
#define rep(i,n) for(int i=0;i<(n);++i)

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n;cin >> n;
	vector<int> a(n);
	rep(i,n) cin >> a.at(i);
	int ans=0;
	rep(i,n){
		while(a.at(i)%2==0){
			ans++;
			a.at(i)/=2;
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
import sys
from networkx import*
i=sys.stdin.readline
m=10**15
N,M,S,T=map(int,i().split())
G=Graph()
G.add_nodes_from(range(1,N+1))
for _ in range(M):u,v,a,b=map(int,i().split());G.add_edge(u,v,y=a,s=b)
y=single_source_dijkstra_path_length(G,S,weight='y')
s=single_source_dijkstra_path_length(G,T,weight='s')
a=[m]*(N+1)
for j in range(N,0,-1):a[j-1]=min(a[j],y[j]+s[j])
for x in a[:N]:print(m-x)

Measured memory_bytes: 186484
#include<bits/stdc++.h>
using namespace std;
int main(){
string s;
cin>>s;
string  SUN = "SUN",
MON = "MON",
TUE = "TUE",
WED = "WED",
THU="THU",
FRI="FRI",
SAT="SAT";
if (s == SUN){
    cout<<"7";
}
else if(s == MON)
    cout<<"6";
else if(s == TUE){
    cout<<"5";
}
else if( s == WED)
cout<<"4";
else if( s == THU)
cout<<"3";
else if( s == FRI)
cout<<"2";
else if( s == SAT)
cout<<"1";    
return 0;
}

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

int main()
{
	int A, B, C;
	int count = 0;
	cin >> A >> B >> C;

	if (B >= C)
	{
		cout << B + C << endl;
		return 0;
	}
	
		for (;C > 0;C--)
		{
			if (B > 0)
			{
				B--;
				count++;
			}
			else if(A > 0)
			{
				A--;
			}
			else
			{
				count++;
				break;
			}
			count++;
		}
	cout << count << endl;
	return 0;
}

Measured memory_bytes: 256
n,m = map(int,raw_input().split())

arr = []

for i in range(m):
	arr.append(map(int,raw_input().split()))

arr = sorted(arr, key=lambda x: x[1])


ans = 0
t = 0


for i in range(m):
	if arr[i][0] >= t:
		ans += 1
		t = arr[i][1]

print ans



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

bool acgt(string s){
  bool flag = true;
  for (int i=0;i<s.size();i++){
    if (s[i] != 'A' && s[i] != 'C' && s[i] != 'G' && s[i] != 'T'){
      flag = false;
    }
    if (!flag) break;;
  }
  return flag;
}

int main(){
  string s;
  cin >> s;
  bool flag;
  int m = 0;
  for (int i=0;i<s.size();i++){
    for (int j=i;j<s.size()+1;j++){
      flag = acgt(s.substr(i,j-i));
      if (flag) m = max(m,j-i);
    }
  }

  cout << m << endl;
  return 0;
}


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

using namespace std;
using ll = long long;
using vl = vector<ll>;
using pll = pair<ll, ll>;

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

template <class T1, class T2>
inline void chmax(T1 &a, const T2 &b)
{
    if (a < b)
    {
        a = b;
    }
}
template <class T1, class T2>
inline void chmin(T1 &a, const T2 &b)
{
    if (a > b)
    {
        a = b;
    }
}

constexpr ll INF = 0x3f3f3f3f3f3f3f3fLL;

inline int max_B(const vector<uint64_t> &B, const uint64_t key, const int M)
{
    int left = -1;
    int right = M + 1;
    while (right - left > 1)
    {
        int mid = (left + right) / 2;
        if (B[mid] <= key)
        {
            left = mid;
        }
        else
        {
            right = mid;
        }
    }
    return left;
}
int main()
{
    int N, M;
    uint64_t K;
    cin >> N >> M >> K;
    vector<uint64_t> A(N + 1), B(M + 1);
    A[0] = 0;
    B[0] = 0;
    for (int i = 1; i < N + 1; ++i)
    {
        uint64_t num;
        cin >> num;
        A[i] = A[i - 1] + num;
    }
    for (int i = 1; i < M + 1; ++i)
    {
        uint64_t num;
        cin >> num;
        B[i] = B[i - 1] + num;
    }

    ll ans = 0;

    rep(i, N + 1)
    {
        if (K < A[i])
        {
            break;
        }

        int b = max_B(B, K - A[i], M);
        if (b != -1)
        {
            chmax(ans, i + b);
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 6424
#include <bits/stdc++.h>
using namespace std;
int main(){
	long long int x, a = 100;
	long long int count = 0;
	cin >> x;
	while(1){
		a += (a / 100);
		count++;
		if(a >= x){
			cout << count << endl;
			return 0;
		}
	}
}

Measured memory_bytes: 3620
using System;

namespace ITP1
{
    class Program
    {
        static void Main(string[] args)
        {

            string[] input = Console.ReadLine().Split(' ');
            

            Array.Sort(input);
            Console.WriteLine(input[0] + " " + input[1] + " " + input[2]);
          
        }
    }
}

Measured memory_bytes: 9936
#[allow(unused_imports)]
use std::cmp::{max, min, Ordering};
#[allow(unused_imports)]
use std::collections::{BTreeMap, BTreeSet, BinaryHeap, HashMap, HashSet, VecDeque};
#[allow(unused_imports)]
use std::iter::FromIterator;
#[allow(unused_imports)]
use std::io::stdin;

mod util {
    use std::io::stdin;
    use std::str::FromStr;
    use std::fmt::Debug;

    #[allow(dead_code)]
    pub fn line() -> String {
        let mut line: String = String::new();
        stdin().read_line(&mut line).unwrap();
        line.trim().to_string()
    }

    #[allow(dead_code)]
    pub fn gets<T: FromStr>() -> Vec<T>
    where
        <T as FromStr>::Err: Debug,
    {
        let mut line: String = String::new();
        stdin().read_line(&mut line).unwrap();
        line.split_whitespace()
            .map(|t| t.parse().unwrap())
            .collect()
    }
}

#[allow(unused_macros)]
macro_rules! get {
    ($t:ty) => {
        {
            let mut line: String = String::new();
            stdin().read_line(&mut line).unwrap();
            line.trim().parse::<$t>().unwrap()
        }
    };
    ($($t:ty),*) => {
        {
            let mut line: String = String::new();
            stdin().read_line(&mut line).unwrap();
            let mut iter = line.split_whitespace();
            (
                $(iter.next().unwrap().parse::<$t>().unwrap(),)*
            )
        }
    };
    ($t:ty; $n:expr) => {
        (0..$n).map(|_|
                    get!($t)
                   ).collect::<Vec<_>>()
    };
    ($($t:ty),*; $n:expr) => {
        (0..$n).map(|_|
                    get!($($t),*)
                   ).collect::<Vec<_>>()
    };
    ($t:ty ;;) => {
        {
            let mut line: String = String::new();
            stdin().read_line(&mut line).unwrap();
            line.split_whitespace()
                .map(|t| t.parse::<$t>().unwrap())
                .collect::<Vec<_>>()
        }
    };
}

#[allow(unused_macros)]
macro_rules! debug {
    ($($a:expr),*) => {
        println!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);
    }
}

fn main() {
    let (x, y) = get!(i64, i64);

    let mut ans = (y.abs() - x.abs()).abs();

    if y == 0 && x < 0 {
    } else if x == 0 {
        if y < 0 {
            ans += 1;
        }
    } else if x.signum() != y.signum() {
        ans += 1;
    } else if x > y {
        ans += 2;
    }

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


Measured memory_bytes: 4352
read = lambda: map(int, input().split())
n = int(input())
a = [tuple(read()) for i in range(n)]
f = 0
for i in range(n - 2):
	if a[i][0] == a[i][1] and a[i+1][0] == a[i+1][1] and a[i+2][0] == a[i+2][1]:
		f = 1
print('Yes' if f else 'No')

Measured memory_bytes: 9220
#include <iostream>
#include <stdio.h>
#include <math.h>
#include <cctype>
#include <cstdio>
using namespace std;

int main(){
   char ch;

   while(1){
      scanf("%c",&ch);

      if(islower(ch)) printf("%c",toupper(ch));
      else if(isupper(ch)) printf("%c",tolower(ch));
      else printf("%c",ch);

      if(ch=='\n') break;
   }

   return 0;
}



Measured memory_bytes: 3124
#include <stdio.h>
#include <string.h>


int main(){
  int sum,i;
  char str[2000];
  int len;

  while(1){

    scanf("%s",str);
    len=strlen(str);
    if(len==1&&str[0]=='0')break;

    sum=0;
    for(i=0;i<len;i++){
      sum +=( str[i]-48);
    
    }

    printf("%d\n",sum);
  }

  return 0;
}

Measured memory_bytes: 540