akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
 
#define REP(i, s) for (int i = 0; i < s; ++i)
#define ALL(v) (v).begin(), (v).end()
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)
#define DEBUG
#define int long long
#define INF 1e18
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; }
template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P)
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P)
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; }
template<class T> ostream& operator << (ostream &s, vector<vector<T> > P)
{ for (int i = 0; i < P.size(); ++i) { s << endl << P[i]; } return s << endl; }
template<class T> ostream& operator << (ostream &s, set<T> P)
{ EACH(it, P) { s << "<" << *it << "> "; } return s << endl; }
template<class T1, class T2> ostream& operator << (ostream &s, map<T1,T2> P)
{ EACH(it, P) { s << "<" << it->first << "->" << it->second << "> "; } return s << endl; }
template<class T>void show(vector<T>v){for (int i = 0; i < v.size(); i++){cerr<<v[i]<<" ";}cerr<<"\n";}
typedef long long ll;
int a[200010];
signed main(){
   int n;
   cin>>n;
   ll sum=0;
   REP(i,n) {
       cin>>a[i];
       sum+=a[i];
   }
   ll cnt=0;
   ll ans=INF;
   for (int i = 0; i < n; i++)
   {
        cnt+=a[i];
        ans=min(ans,abs(sum-2*cnt));   
   }
   cout<<ans<<endl;

    return 0;
}

Measured memory_bytes: 1792
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <numeric>
#include <string>
#include <unordered_map>
#include <queue>
#include <set>
using namespace std;


int main(){
    int n;
    string s;
    cin >> n >> s;
    int count = 0;
    char tmp = s[0];
    for (int i = 1; i < n; i++){
        if (s[i] != tmp){
            count++;
            tmp = s[i];
        }
    }
    count++;
    cout << count << endl;
    return 0;
}

Measured memory_bytes: 512
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

  public static void main(String[] args) throws NumberFormatException, IOException {
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    int N, M;
    String[] U = new String[256];
    String[] T = new String[256];

    N = Integer.parseInt(br.readLine());
    for (int i = 0; i < N; i++) {
      U[i] = br.readLine();
    }

    M = Integer.parseInt(br.readLine());
    for (int i = 0; i < M; i++) {
      T[i] = br.readLine();
    }

    boolean state = false;
    for (int i = 0; i < M; i++) {
      if (search(T[i], U)) {
        if (!state) {
          System.out.println("Opened by " + T[i]);
        } else {
          System.out.println("Closed by " + T[i]);
        }
        state = !state;
      } else {
        System.out.println("Unknown " + T[i]);
      }
    }

  }

  public static boolean search(String s, String[] list) {
    for (int i = 0; i < list.length; i++) {
      if (s.equals(list[i])) {
        return true;
      } else if (s.equals(null)) {
        break;
      }
    }

    return false;
  }

}

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

long long a,b,c;
bool flag=false;

int main()
{
	scanf("%lld %lld %lld",&a,&b,&c);
	if((a*100+10*b+c)%4==0)flag=true;
	if(flag==true)puts("YES");
	else puts("NO");
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long int
mt19937 rng(std::chrono::duration_cast<std::chrono::nanoseconds>(chrono::high_resolution_clock::now().time_since_epoch()).count());
#define mp make_pair
#define pb push_back
#define F first
#define S second
const int N=1000005;
#define M 1000000007
#define double long double
#define BINF 10000000000000
#define init(arr,val) memset(arr,val,sizeof(arr))
#define MAXN 15000001
#define deb(x) cout << #x << " " << x << "\n";
const int LG = 22;

/*
Created at 15:28
*/

int power(int x, int y, int p){
    int res = 1;
    x %= p;
    while(y > 0){
        if(y & 1) res = (res * x) % p;
        x = (x * x) % p;
        y >>= 1;
    }
    return res;
}

multimap<int, int> open;
vector<pair<int, pair<int, int>>> a;
int ans = 0;
vector<int> an;

#undef int 
int main() {
#define int long long int
ios_base::sync_with_stdio(false); 
cin.tie(0); 
cout.tie(0);
 

    int n;
    cin >> n;
    int k = 1;

    for(int i = 0; i < n; i++){
        int x, l;
        cin >> x >> l;
        int off = 1e9 + 1;
        int L = off + x - l;
        int R = off + x + l;
        R--;
        a.push_back({L, {R, i + 1}});
    }

    sort(a.begin(), a.end());
    for (int i = 0; i < n; i++) {
        open.insert(a[i].second);
        if (i < n - 1 && a[i + 1].first == a[i].first) {
            continue;
        }
        auto min_it = open.lower_bound(a[i].first);
        if (min_it == open.begin()) {
            while(open.size() > k) {
                ans++;
                auto it = --open.end();
                an.push_back(it->second);
                open.erase(it);
            }
            continue;
        }
        int min_val = min_it->first;
        if (min_it != open.end()) {
            while(open.begin()->first != min_val) {
                open.erase(open.begin());
            }
        }
        while(open.size() > k) {
            ans++;
            auto it = --open.end();
            an.push_back(it->second);
            open.erase(it);
        }
    }
    cout << n - ans << endl;
    
    

return 0;
}



Measured memory_bytes: 5104
# ARC088D
from queue import deque
def sub(s, k):
    tmp = 0
    q = deque()
    for c in s[:-k+1]:
        if (int(c)+tmp)%2:
            q.appendleft(1)
            tmp += 1
        else:
            q.appendleft(0)
        if len(q)>=k:
            tmp -= q.pop()
        print(q, tmp)
    for c in s[-k+1:]:
        if (int(c)+tmp)%2:
            return False
        tmp -= q.pop()
    return True
    
s = input()
n = len(s)
if n%2:
    m = n//2
    v = s[m]
    c = 0
    while m-c>=0 and m+c<=n-1:
        if s[m+c]==v and s[m-c]==v:
            c += 1
        else:
            break
    print((n + 2*c - 1) // 2)
else:
    m = n//2
    v = s[m]
    c = 0
    while m-1-c>=0 and m+c<=n-1:
        if s[m+c]==v and s[m-1-c]==v:
            c += 1
        else:
            break
    print((n+2*c)//2)

Measured memory_bytes: 40044
#include <iostream>
using namespace std;
int main(){
  int n;
  int d[110];
  cin>>n;
  for(int i=0;i<n;i++) cin>>d[i];

  int num[110]={0};
  for(int i=0;i<n;i++){
    num[d[i]]++;
  }


  int out=0;
  for(int i=1;i<=100;i++){
    if(num[i]){
      out++;
    }
  }
  cout<<out<<endl;
}


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

#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep1(i, n) for (int i = 1; i <= (n); i++)
#define show(a, n) rep(i,n) {cout<<a[i]<<' ';} cout<<endl;

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

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

int main() {
	string a, b;
	cin >> a >> b;
	a += b;
	int i = stoi(a);
	bool ans = false;
	for(int j = 1; j * j <= 100100; j++) {
		if(i == j * j) ans = true;
		if(j > i) break;
	}
	cout << (ans ? "Yes" : "No") << endl;
}


Measured memory_bytes: 256
MOD = 10 ** 9 + 7
INF = 10 ** 12
import sys
sys.setrecursionlimit(100000000)
dy = (-1,0,1,0)
dx = (0,1,0,-1)
from  itertools import permutations
from heapq import heapify,heappop,heappush

def main():
    n = int(input())
    ans = 0
    for i in range(1,n):
        if i * i > n:
            break
        if n%i == 0:
            j = n//i
            if j - 1 > i:
                ans += j - 1
    print(ans)
    
if __name__ =='__main__':
    main()  

Measured memory_bytes: 3064
#include <iostream>

int main()
{
    int n,x;
    while(std::cin>>n>>x && (n||x))
    {
        int c=0;
        for(int i=1; i<=n; i++)
        {
            for(int j=i+1; j<=n; j++)
            {
                for(int k=j+1; k<=n; k++)
                {
                    if(i+j+k==x)
                    {
                        c++;
                    }
                }
            }
        }
        std::cout<<c<<std::endl;
    }
    return 0;
}




Measured memory_bytes: 3100
W, H, N = map(int, input().split())
xl, xh = 0, W
yl, yh = 0, H
for i in range(N):
    x, y, a = map(int, input().split())
    if a == 1:
        xl = max(xl, x)
    elif a == 2:
        xh = min(xh, x)
    elif a == 3:
        yl = max(yl, y)
    else:
        yh = min(yh, y)

if xl >= xh or yl >= yh:
    print(0)
else:
    print((xh-xl) * (yh-yl))


Measured memory_bytes: 3064
import std.algorithm, std.container, std.conv, std.math, std.range, std.typecons, std.stdio, std.string;

auto rdsp(){return readln.splitter;}
void pick(R,T)(ref R r,ref T t){t=r.front.to!T;r.popFront;}
void readV(T...)(ref T t){auto r=rdsp;foreach(ref v;t)pick(r,v);}

void main()
{
  int n, m, s, t; readV(n, m, s, t); --s; --t;

  auto g1 = GraphW!(int, long, 10L^^18)(n), g2 = GraphW!(int, long, 10L^^18)(n);
  foreach (_; 0..m) {
    int u, v, a, b; readV(u, v, a, b); --u; --v;
    g1.addEdgeB(u, v, a);
    g2.addEdgeB(u, v, b);
  }

  auto d1 = g1.dijkstra(s), d2 = g2.dijkstra(t);

  auto r = new long[](n);
  r[$-1] = d1[$-1]+d2[$-1];
  foreach_reverse (i; 0..n-1)
    r[i] = min(r[i+1], d1[i]+d2[i]);

  foreach (i; 0..n) writeln(10L^^15-r[i]);
}

struct GraphW(N = int, W = int, W i = 10^^9)
{
  alias Node = N, Wt = W, inf = i;
  struct Edge { Node src, dst; Wt wt; alias cap = wt; }
  Node n;
  Edge[][] g;
  alias g this;
  this(Node n) { this.n = n; g = new Edge[][](n); }
  void addEdge(Node u, Node v, Wt w) { g[u] ~= Edge(u, v, w); }
  void addEdgeB(Node u, Node v, Wt w) { g[u] ~= Edge(u, v, w); g[v] ~= Edge(v, u, w); }
}

template Dijkstra(Graph)
{
  import std.array, std.container, std.traits;
  alias Node = TemplateArgsOf!Graph[0], Wt = TemplateArgsOf!Graph[1];
  alias Edge = Graph.Edge;

  void dijkstra(ref Graph g, Node s, out Wt[] dist, out Node[] prev)
  {
    auto n = g.n, sent = n;

    dist = new Wt[](n);
    dist[] = g.inf;
    dist[s] = 0;

    prev = new Node[](n);
    prev[] = sent;

    auto q = heapify!("a.wt > b.wt")(Array!Edge(Edge(sent, s, 0)));
    while (!q.empty) {
      auto e = q.front; q.removeFront();
      if (prev[e.dst] != sent) continue;
      prev[e.dst] = e.src;
      foreach (f; g[e.dst]) {
        auto w = e.wt + f.wt;
        if (dist[f.dst] > w) {
          dist[f.dst] = w;
          q.insert(Edge(f.src, f.dst, w));
        }
      }
    }
  }

  auto dijkstra(ref Graph g, Node s)
  {
    Wt[] dist;
    Node[] prev;
    dijkstra(g, s, dist, prev);
    return dist;
  }
}
auto dijkstra(G, N)(G g, N s) { return Dijkstra!G.dijkstra(g, s); }


Measured memory_bytes: 29332
#abc154 d
n,k=map(int,input().split())
p=list(map(int,input().split()))
wa=[0]*(n+1)

for i in range(n):
    wa[i+1]=p[i]+wa[i]

ans=0
for i in range(n-k+1):
    kitai=k+wa[i+k]-wa[i]
    if kitai>ans:
        ans=kitai
ans/=2
print(ans)

Measured memory_bytes: 24808
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0;i<n;i++)
#define rep2(i,a,n) for(int i=a;i<n;i++)
#define been(ix) (ix).begin(),(ix).end()
using namespace std;
typedef long long ll; 
typedef vector<int> vi;
typedef vector<long long> vl;
const ll INFL = 1e18;
const int INF = 1001001001; 
typedef pair<int,int> P;
#define foreach(ix,i) for(auto& (ix) : (i))
typedef long double ld;
const int mod =1000000007;
const double PI = acos(-1);
int main(){
    int n,q;cin>>n;
    int a[n],b[n];
    ll am =0,bm=0;
    rep(i,n){
        cin>>a[i];
        am+=a[i];
    }
    rep(i,n){
        cin>>b[i];
        bm+=b[i];
    }
    ll d =bm-am;
    ll an=0,bn=0;
    rep(i,n){
        if(b[i]>a[i]){
            an+=((b[i]-a[i])/2)+((a[i]-b[i])%2?1:0);
        }
        else if(a[i]>b[i]){
            bn+=(a[i]-b[i]);
        }
    }
    if(an<=d&&bn<=d)cout<<"Yes"<<endl;
    else
    {
        cout<<"No"<<endl;
    }
    
}

Measured memory_bytes: 3676
#include <stdio.h>

int main() {
  int a,b,c,r;
  scanf("%d %d %d",&a,&b,&c);
  if (b+c <=a ) {
    r = 0;
  }else{
    r = (b+c)-a;
  }
  printf("%d\n", r);
  return 0;
}


Measured memory_bytes: 128
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<numeric>
#include<cmath>

using namespace std;

typedef long long int ll;
const int INF = 1<<30;
const long long LINF = 1LL<<60;

int main(){
    int a, b, q;
    cin >> a >> b >> q;
    vector<ll> s(a), t(b);
    for(int i = 0; i < a; i++){
        cin >> s[i];
    }
    for(int i = 0; i < b; i++){
        cin >> t[i];
    }
    for(int i = 0; i < q; i++){
        ll x, ans = LINF;
        cin >> x;
        auto itr1 = lower_bound(begin(s), end(s), x);
        auto itr2 = lower_bound(begin(t), end(t), x);
        if(itr1 != end(s)){
            if(itr2 != end(t)){
                ans = min(ans, max(abs(*itr1 - x), abs(*itr2 - x)));
            }
            if(itr2 != begin(t)){
                ans = min(ans, min(abs(*itr1 - x) * 2 + abs(*(itr2 - 1) - x), abs(*itr1 - x) + abs(*(itr2 - 1) - x) * 2));
            }
        }
        if(itr1 != begin(s)){
            if(itr2 != begin(t)){
                ans = min(ans, max(abs(*(itr1 - 1) - x), abs(*(itr2 - 1) - x)));
            }
            if(itr2 != end(t)){
                ans = min(ans, min(abs(*(itr1 - 1) - x) * 2 + abs(*itr2 - x), abs(*(itr1 - 1) - x) + abs(*itr2 - x) * 2));
            }
        }
        cout << ans << endl;
    }
    return 0;
}


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

int main() {
    char a, b, c, d; cin >> a >> b >> c >> d;
    int A, B, C, D;
    A = a - '0';
    B = b - '0';
    C = c - '0';
    D = d - '0';
    vector<int> ans(8);
    ans.at(0) = A + B + C + D;
    ans.at(1) = A + B + C - D;
    ans.at(2) = A + B - C + D;
    ans.at(3) = A - B + C + D;
    ans.at(4) = A + B - C - D;
    ans.at(5) = A - B - C + D;
    ans.at(6) = A - B + C - D;
    ans.at(7) = A - B - C - D;
    for (int i = 0; i < 8; i++) {
        if (ans.at(i) == 7) {
            switch (i) {
                case 0:
                    cout << A << "+" << B << "+" << C << "+" << D << "=7" << endl;
                    break;
                case 1:
                    cout << A << "+" << B << "+" << C << "-" << D << "=7" << endl;
                    break;
                case 2:
                    cout << A << "+" << B << "-" << C << "+" << D << "=7" << endl;
                    break;
                case 3:
                    cout << A << "-" << B << "+" << C << "+" << D << "=7" << endl;
                    break;
                case 4:
                    cout << A << "+" << B << "-" << C << "-" << D << "=7" << endl;
                    break;
                case 5:
                    cout << A << "-" << B << "-" << C << "+" << D << "=7" << endl;
                    break;
                case 6:
                    cout << A << "-" << B << "+" << C << "-" << D << "=7" << endl;
                    break;
                case 7:
                    cout << A << "-" << B << "-" << C << "-" << D << "=7" << endl;
                    break;
                default:
                    break;
            }
            return 0;
        }
    }
}

Measured memory_bytes: 3592
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define N_MAX (12)
#define M_MAX (12)
 
int main() {
  int N;
  ll K;

  cin >> N >> K;

  vector<int> A(N);
  vector<int> index(N, -1);

  rep(i, N){
    int tmp;
    cin >> tmp;
    tmp--;
    A.at(i) = tmp;
  }
  
  index.at(0) = 0;
  int p = 0;
  int count = 0;
  int l = 0;
  int l0 = 0;
  vector<int> s;

  s.push_back(0);
  while(true){
    p = A.at(p);
    s.push_back(p);
    count++;
    if(index.at(p) != -1){
      l = count - index.at(p);
      l0 = index.at(p);
      break;
    }
    else{
      index.at(p) = count;
    }
  }

  if(K < l0){
    cout << s.at(K) + 1 << endl;
  }
  else{
    K = (K-l0)%l;
    cout << s.at(K+l0) + 1 << endl;
  }
  
  return 0;
}


Measured memory_bytes: 5884
import math
N, D=map(int, input().split())
lists=[input().split() for i  in range(N)]

count=0
for i in range(N):
  for j in range(i+1,N):
    mass=0
    for z in range(D):
      mass += (int(lists[i][z])-int(lists[j][z]))**2
    if(math.sqrt(mass).is_integer()):
      count+=1
print(count)

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

int main(){
	// sengen
	LL n,ans = 0;
	// nyuryoku
	cin >> n;
	LL a[n];
	for(LL i=0;i<n;i++){
		cin >> a[i];
	}
	// keisan
	for(LL i=1;i<n;i++){
		if(a[i] < a[i-1]){
			ans = ans + a[i-1] - a[i];
			a[i] = a[i-1];
		}
	}
	// syutsuryoku
	cout << ans << endl;
}

Measured memory_bytes: 5196
#include <iostream>
using namespace std;
int n;
long long int d,c,day,ans;

long long solve(int d){
    if(d == 0) return 1;
    if(d < 0) return 0;
    c = solve(d-1) + solve(d-2) + solve(d-3);
    return c;
}

int main(void){
    // Your code here!
    while(cin >> n&&n){
        cout << solve(n)/3650 + 1 << endl;
    }
    return 0;
}

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

#define pb         push_back

typedef long long ll;
const ll INF = 1000000000000000000ll;
const ll MOD = 1000000007ll;
const double EPS = 1e-8;


int ans[27];
int main(void) {
	//ios_base::sync_with_stdio(false);
	//cin.tie(0);
	
	int n;
	cin >> n;

	for(int j=0; j<27; j++){
		ans[j] = 20000000;
	}

	for(int i=0; i<n; i++){
		int chara[27];
		string s;
		cin >> s;

		for(int j=0; j<27; j++){
			chara[j] = 0;
		}

		for(int j=0; j<s.size(); j++){
			chara[s[j]-'a']++;
		}

		for(int j=0; j<27; j++){
			ans[j] = min(ans[j], chara[j]);
		}
	}

	for(int i=0; i<27; i++){
		for(int j=0; j<ans[i]; j++){
			printf("%c", 'a' + i);
		}
	}
	puts("");

	
	return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <bitset>
#include <set>
#include <iomanip>
#include <functional>
using namespace std;
typedef long long ll;
#define rep(i, a, b) for (int i = a; i < b; i++)
//'A' = 65, 'a' = 97

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

    if ((s[0] == s[1] && s[1] == s[2]) || (s[1] == s[2] && s[2] == s[3])) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }

}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;

public class Main {
    public static void main(String[] args) throws IOException {
        new Main().run();
    }

    private void run() throws IOException {
        boolean b = true;
        final BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        while (b) {
            b = runOnce(reader);
        }

        reader.close();
    }

    private boolean runOnce(final BufferedReader reader) throws IOException {
        final String[] params = reader.readLine().split(" ");
        final int count = Integer.parseInt(params[0]);
        final int max = Integer.parseInt(params[1]);
        if (count == 0 && max == 0) return false;
        final List<Integer> prices = Arrays.stream(reader.readLine().split(" "))
                .map(Integer::parseInt)
                .sorted()
                .collect(Collectors.toList());
        int nextLow = 0;
        int maxSum = 0;
        for (int i = prices.size() - 1; i >= 0; i--) {
            int tmpNextLow = nextLow;
            for (int j = nextLow; j < i; j++) {
                if (prices.get(i) + prices.get(j) <= max) {
                    tmpNextLow++;
                } else {
                    break;
                }
            }
            if (tmpNextLow == nextLow) continue;
            maxSum = Math.max(maxSum, prices.get(i) + prices.get(tmpNextLow - 1));
            nextLow = tmpNextLow;
        }
        System.out.println(maxSum == 0 ? "NONE" : maxSum);
        return true;
    }


}

Measured memory_bytes: 34956
#include <iostream>
#include <vector>
#include <algorithm>
#include <iterator>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <string>
#include <cmath>
using namespace std;
#define MOD 1000000007
#define INF 1<<30
#define LINF (ll)1<<62
#define MAX 510000
#define rep(i,n) for(ll i=0; i<(n); i++)
#define REP(i,a,b) for(ll i=(a); i<(b); i++)
#define all(x) (x).begin(),(x).end()
#define uni(q) unique(all(q)),q.end()
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<ll, ll> P;
typedef vector<pair<ll, ll>> vpl;

vl bit(40,0),fun(40),sum(41,0);
ll n,k;

int main(){
    ll t = 'a' - 'A';
    string s[3];
    rep(i,3) cin >> s[i];
    rep(i,3) cout << (char)(s[i][0]-t);
    cout << endl;
}


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

using namespace std;

#define REP(i,m) for(int i=0; i<m; i++)
#define FOR(i,n,m) for(int i=n; i<m; i++)
#define INF 1000000007
#define INFL (1LL << 60)
#define MOD 998244353
#define ALL(v) v.begin(),v.end()
#define pb push_back
#define ll long long int
#define P pair<ll, ll>

int d[3][100010] = { };

int main(){
	int n;
	cin >> n;
	int a[3][n];
	REP(i, n){
		REP(j, 3) cin >> a[j][i];
	}
	REP(i, 3) d[i][0] = 0;
	REP(i, n){
		REP(j, 3){
			d[j][i+1] = max(d[(j+1)%3][i]+a[j][i], d[(j+2)%3][i]+a[j][i]);
		}
	}
	cout << max({d[0][n], d[1][n], d[2][n]}) << endl;
} 

Measured memory_bytes: 2560
#include<iostream>

using namespace std;

int main(){
  int a,b,c,d=0,x;
  cin >> a >> b >> c;
  for(int x = a ; x <= b; ++x){
    if(c%x==0){
      d=d+1;
    }
  }
    cout << d << endl;
    return 0;
  }



Measured memory_bytes: 3088
#include <bits/stdc++.h>
#define DEBUG fprintf(stderr, "Passing [%s] line %d\n", __FUNCTION__, __LINE__)
#define File(x) freopen(x".in","r",stdin); freopen(x".out","w",stdout)

using namespace std;

typedef long long LL;
typedef pair <int, int> PII;
typedef pair <int, PII> PIII;

inline int gi()
{
	int f = 1, x = 0; char c = getchar();
	while (c < '0' || c > '9') {if (c == '-') f = -1; c = getchar();}
	while (c >= '0' && c <= '9') x = x * 10 + c - '0', c = getchar();
	return f * x;
}

inline LL gl()
{
	LL f = 1, x = 0; char c = getchar();
	while (c < '0' || c > '9') {if (c == '-') f = -1; c = getchar();}
	while (c >= '0' && c <= '9') x = x * 10 + c - '0', c = getchar();
	return f * x;
}

const int N = 200003, mod = 1000000007;

int n, m;
int a[N];
char s[N];

int main()
{
    n = gi();
    double ans = acos(-1) * 2 * n;
    printf("%.13lf\n", ans);
    return 0;
}

Measured memory_bytes: 3764
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <cstring>
#include <math.h>
#include <bitset>
#include <queue>
#include <set>
#include <iomanip>
#include <math.h>
#include <assert.h>
// #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
constexpr long long int INFLL = 1001001001001001LL;
constexpr long long int infll = 1001001001001001LL;
constexpr int INF = 1000000007;
constexpr int inf = 1000000007;
const int mod = 1000000007;

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

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

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

inline double nCr(const int n, int r)
{
    if (n == 0)
    {
        return 0;
    }
    if (r == 0)
    {
        return 1;
    }
    if (r == 1)
    {
        return n;
    }
    if (n == r)
    {
        return 1;
    }

    if (r > n / 2)
    {
        r = n / 2;
    }

    double result = 1;
    for (double i = 1; i <= r; i++)
    {
        result *= (n - i + 1) / i;
    }

    return (result);
}

template <typename T>
T seinomi(T a)
{
    if (a > 0)
    {
        return a;
    }
    else
    {
        return 0;
    }
}

template <typename T>
map<T, T> soinsuubunkai(T n) //連想配列[素因数f.first][個数f.second]
{
    map<T, T> ret;
    for (T i = 2; i * i <= n; i++)
    {
        while (n % i == 0)
        {
            ret[i]++;
            n /= i;
        }
    }
    if (n != 1)
        ret[n] = 1;
    return ret;
}

template <typename T>
T ketasuu(T num)
{
    return std::to_string(num).length();
}

int kaizyou(int k)
{
    int sum = 1;
    for (int i = 1; i <= k; ++i)
    {
        sum *= i;
    }
    return sum;
}

template <class ForwardIt, class T>
void iota(ForwardIt first, ForwardIt last, T value)
{
    while (first != last)
    {
        *first++ = value;
        ++value;
    }
}

//nの階乗を計算
int factorial(int n)
{
    int answer = 1;
    while (n > 1)
    {
        answer *= n;
        n--;
    }
    return answer;
}
int comb(int n, int r)
{
    return factorial(n) / (factorial(r) * factorial(n - r));
}

long long modpow(long long a, long long n, long long mod)
{
    long long res = 1;
    while (n > 0)
    {
        if (n & 1)
            res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}


template <typename T>
T amarinasi(T a,T b){
    if(a%b==0)
{
    return a/b;
}
else if(a%b>0)
{
    return a/b+1;
}
else
{
    return a/b-1;
}
}

//小数点以下10桁テンプレート（main関数内の最初に貼付け）
//std::cout << std::fixed << std::setprecision(10);

//----------------------------------------------------------------

int main(){
ll n;
cin>>n;
string tmp=to_string(n);
ll sum=0;
for(int i=0;i<tmp.size();i++){
    sum+=tmp.at(i)-'0';
}
if(n%sum==0){
    cout<<"Yes"<<endl;
}else{
    cout<<"No"<<endl;
}
}












Measured memory_bytes: 256
#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <bitset>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <numeric>
#include <iostream>
#include <iomanip>
#include <string>
#include <chrono>
#include <random>
#include <cmath>
#include <cassert>
#include <climits>
#include <cstring>
#include <cstdlib>
#include <functional>
#include <sstream>

using namespace std;



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

    int n;
    cin >> n;
    int res = 0;
    if (n % 2 == 0) {
        res = n;
    } else {
        res = n * 2;
    }
    cout << res << '\n';
    
    return 0;
}

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

using ll=long long;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define REP(i,k,n) for(ll i=k;i<(ll)(n);i++)
template<class T> void out(T a){cout<<a<<'\n';}

int main(){
  int n,q;
  cin>>n>>q;
  fenwick_tree<ll> ft(n);
  rep(i,n){
    int x; cin>>x;
    ft.add(i,x);
  }
  rep(i,q){
    int k; cin>>k;
    if(k==0){
      int p,x;
      cin>>p>>x;
      ft.add(p,x);
    }
    else{
      int l,r;
      cin>>l>>r;
      out(ft.sum(l,r));
    }
  }
}


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

#define mk(a,b) make_pair(a,b)
#define se second
#define fi first

typedef pair<int, int> pii;
typedef pair<int, pii> iii;

int N, M;
vector<iii> edge;
vector<int> mem;

int par[510];

void init() {
    for(int i = 0; i <= N; i++) {
        par[i] = i;
    }
}

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

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

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

int main() {
    cin >> N >> M;
    for(int i = 0; i < M; i++) {
        int s, d, c;
        cin >> s >> d >> c;
        edge.push_back(mk(c, mk(s, d)));
    }

    sort(edge.begin(), edge.end());

    int min_cost = 0;
    init();
    for(int i = 0; i < edge.size(); i++) {
        iii now = edge[i];
        int a = now.se.fi, b = now.se.se;
        int cost = now.fi;

        if(!same(a, b)) {
            unite(a, b);
            mem.push_back(i);
            min_cost += cost;
        }
    }

    int ans = 0;
    int ans_cost = 0;

    for(int j = 0; j < mem.size(); j++) {
        int now_cost = 0;
        int now_count = 0;
        init();
        for(int i = 0; i < edge.size(); i++) {
            if(i == mem[j])continue;

            iii now = edge[i];
            int a = now.se.fi, b = now.se.se;
            int cost = now.fi;

            if(!same(a, b)) {
                unite(a, b);
                now_cost += cost;
                now_count++;
            }
        }

        if(now_count != N - 1 || now_cost != min_cost) {
            ans++;
            ans_cost += edge[mem[j]].fi;
        }
    }

    cout << ans << " " << ans_cost << endl;

    return 0;
}



Measured memory_bytes: 3804
#include <bits/stdc++.h>
using namespace std;
int main(void)
{
	int a, b;
	cin >> a >> b;
	int maxv = max(a, b);
	int minv = min(a, b);
	int c = minv - 1;
	int d = maxv - c;

	int count = 0;
	bool da[100][100];
	fill(da[0], da[0]+100*100, false);
	for (int i = 0; i < 25; i++) {
		for (int j = 0; j < 25; j++) {
			if (!(count < c))
				goto end;
			int ox = j*4;
			int oy = i*4;
			da[oy+0][ox+0] = true;
			da[oy+0][ox+1] = true;
			da[oy+0][ox+2] = true;
			da[oy+1][ox+0] = true;
			da[oy+1][ox+2] = true;
			da[oy+2][ox+0] = true;
			da[oy+2][ox+1] = true;
			da[oy+2][ox+2] = true;
			count++;
		}
	}
end:

	count = 0;
	for (int i = 0; i < 10; i++) {
		for (int j = 0; j < 50; j++) {
			if (!(count < d))
				goto end2;
			int oy = 80+i*2;
			int ox = j*2;
			da[oy][ox] = true;
			count++;
		}
	}
end2:

  
  	printf("100 100\n");
	for (int y = 0; y < 100; y++) {
		for (int x = 0; x < 100; x++) {
			if (minv == maxv) {
				if (da[y][x])
					putchar('#');
				else
					putchar('.');
			} else {
				if (maxv == b) {
					if (da[y][x])
						putchar('#');
					else
						putchar('.');
				} else {
					if (da[y][x])
						putchar('.');
					else
						putchar('#');
				}
			}
		}
		cout << endl;
	}

	return 0;
}

Measured memory_bytes: 3688
K, N = map(int, input().split())
arr = list(map(int, input().split()))
dist = [K-arr[N-1]+arr[0]]
for i in range(1,N):
    dist.append(arr[i]-arr[i-1])
tmp = sum(dist)
ans = sum(dist)
for i in range(N):
    ans = min(ans,tmp-dist[i])
print(ans)

Measured memory_bytes: 25840
#include<iostream>
#include<vector>
#include<cmath>

int main(){
	int n, x;
	std::cin>>n>>x;

	if(x==1 || x== 2*n-1){
		std::cout<<"No"<<std::endl;
		return 0;
	}

	std::cout<<"Yes"<<std::endl;

	int count1=0;
	int count2=0;
	if(x>=n)
		count2++;

	while(count1<n-1){
		if(n-count2 == x){
			count2++;
			continue;
		}

		std::cout<<n-count2<<std::endl;
		count1++;
		count2++;
	}

	std::cout<<x<<std::endl;
	count1=0;
	count2=0;

	while(count1<n-1){
		if((2*n-1)-count2 == x){
			count2++;
			continue;
		}

		std::cout<<(2*n-1)-count2<<std::endl;
		count1++;
		count2++;
	}

	return 0;
}

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

using namespace std;
using ll = long long;

int n, m;
vector<vector<int>> g;
vector<int> p;

void s(int v, int num) {
    if (p[v] == -1) p[v] = num;
    else return;

    for (auto vv : g[v]) {
        s(vv, num);
    }
}

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

    g.assign(n, vector<int> ());
    p.assign(n, -1);
    
    for (int i = 0; i < m; i++) {
        int a, b;
        cin >> a >> b;
        a--;
        b--;
        g[a].push_back(b);
        g[b].push_back(a);
    }

    
    int num = 0;
    for (int i = 0; i < n; i++) {
        if (p[i] == -1) {
            num++;
            s(i, num);
        }
    }

    cout << num - 1 << endl;
}

Measured memory_bytes: 9520
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define ios ios_base::sync_with_stdio(0) ; cin.tie(0) ; cout.tie(0)
ll n;
vector<ll> v;
#define pb push_back
#define so sizeof
int main()
{
    ios;
    cin >> n;
    v.pb(0);
    for(ll i =1 ;i<=n;++i){
        ll x;
        cin >>  x;
        v.pb(x);
    }
    ll dp[n+1];
    for(ll i =1 ; i<=n ; ++i) dp[i] = 3e18;
    dp[1] = 0 ;
    dp[2] = abs(v[2]-v[1]);
    for(ll i=3;i<=n;++i){
        ll c1 = dp[i-2] + abs(v[i]-v[i-2]);
        ll c2 = dp[i-1] + abs(v[i]-v[i-1]);
        dp[i] = min(c1 , c2);
    }
    cout << dp[n] << endl;
    return 0;
}


Measured memory_bytes: 1908
#include <algorithm>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <string>
#include <vector>

using namespace std;
using LLONG = long long;
const LLONG MOD = 1000000007;

int main()
{
    int N;
    cin >> N;
    vector<int> Hs(N);
    int cur = 0;
    cin >> cur;
    int mov = 0, maxMov = 0;
    for (int i = 1; i < N; ++i)
    {
        int Hi;
        cin >> Hi;
        if (cur >= Hi)
        {
            ++mov;
        }
        else
        {
            if (mov > maxMov)
            {
                maxMov = mov;
            }
            mov = 0;
        }
        cur = Hi;
    }
    cout << max(mov, maxMov) << endl;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define repr(i,k,n) for(int i = (k); i < (n); i++)
#define rep(i,n) repr(i,0,n)
#define ALL(a) begin(a),end(a)
const int INF = 114514810;
const int MOD = 1000000007;
typedef vector<int> vi;
typedef vector<string> vs;
typedef long long ll;
int ctoi(const char c){
  switch(c){
    case '0': return 0;
    case '1': return 1;
    case '2': return 2;
    case '3': return 3;
    case '4': return 4;
    case '5': return 5;
    case '6': return 6;
    case '7': return 7;
    case '8': return 8;
    case '9': return 9;
  }
}
int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int N;
	bool B=false;
	cin >> N;
	if (N%4==0||N%7==0){
		B=true;
	}
	repr(d,1,15){
		if ((N-d*7)%4==0&&N-d*7>=0){
			B=true;
		}
	}
	cout << (B?"Yes":"No") << endl;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
int main() {
	long long N;
	cin >> N;
	vector<long long>A(N);
	deque<long long>B;
	for (int i = 0; i < N; i++) {
		cin >> A.at(i);
		if (i % 2 == 0) B.push_back(A.at(i));
		else B.push_front(A.at(i));
	}
	for (int i = 0; i < N; i++) {
		if (N % 2 != 0) cout << B.back();
		else cout << B.front();
		if (i != N - 1) cout << ' ';
		if (N % 2 != 0) B.pop_back();
		else B.pop_front();
	}
}

Measured memory_bytes: 5376
def count(l):
    res = {}
    for d in l:
        if d in res:
            res[d] += 1
        else:
            res[d] = 1
    return res
n = int(input())
data = list(map(int, input().split()))
d = count(data)
ans = sum(v*(v-1)//2 for v in d.values())
for a in data:
    banned = d[a] - 1
    print(ans-banned)

Measured memory_bytes: 26140
from itertools import product
A, B, C, X = [int(input()) for _ in range(4)]
ans = 0
for a, b, c in product(range(A + 1), range(B + 1), range(C + 1)):
    if 500 * a + 100 * b + 50 * c == X:
        ans += 1

print(ans)

Measured memory_bytes: 39536
#include<iostream>
#include<cstring>

bool sieve[1000000];
void makesieve();

int main()
{
	makesieve();
	while(1)
	{
		int n,ans=0;
		std::cin>>n;
		if(std::cin.eof())break;
		for(int i=0;i<=n;i++)
		{
			ans+=sieve[i]?1:0;
		}
		std::cout<<ans<<std::endl;
	}
	return 0;
}

void makesieve()
{
	for(int i=0;i<1000000;i++){sieve[i]=true;}
	sieve[0]=false;sieve[1]=false;
	for(int i=2;i<1000000;i++)
	{
		for(int j=i*2;j<1000000;j+=i)
		{
			sieve[j]=false;
		}
	}
}

Measured memory_bytes: 1844
/*

寮の部屋状態

*/

#include <stdio.h>

void meibo(int arr[][10], int cn); // print 関数

int main(void){
  int i, no;
  int bui, flo, a, num;
  int buildA[3][10] = {0};  // 4 棟の配列初期化
  int buildB[3][10] = {0};
  int buildC[3][10] = {0};
  int buildD[3][10] = {0};

  scanf("%d", &no);

  while(i<no){
    scanf("%d %d %d %d", &bui, &flo, &a, &num);

    if(bui == 1)
      buildA[flo-1][a-1] += num;
    if(bui == 2)
      buildB[flo-1][a-1] += num;
    if(bui == 3)
      buildC[flo-1][a-1] += num;
    if(bui == 4)
      buildD[flo-1][a-1] += num;

    i++;
  }

  meibo(buildA,1);
  meibo(buildB,1);
  meibo(buildC,1);
  meibo(buildD,0);

  return 0;
}

void meibo(int arr[][10], int cn){
  int i, j, k;

  for(i=0;i<3; i++){
    for(j=0; j<10; j++){
      printf(" %d", arr[i][j]);
    }
    printf("\n");
  }

  if(cn != 0){
    for(k=0; k<20;k++){
      printf("#");
    }
    printf("\n");
  }
}



Measured memory_bytes: 1988
#include <bits/stdc++.h>
using namespace std;
#define rep0(i,n) for(ll (i) = 0; (i) < (n); ++(i))
#define rrep0(i,n) for(ll (i) = (n) - 1; (i) >= 0; --(i))
#define rep1(i,n) for(ll (i) = 1; (i) <= (n); ++(i))
#define rrep1(i,n) for(ll (i) = (n); (i) >= 1; --(i))
#define nfor(i,a,b) for(ll (i) = (a); (i) < (b); ++(i))
#define rfor(i,a,b) for(ll (i) = (a); (i) > (b); --(i))
#define ll long long
#define mod (1000000007)
#define pf(a) cout << (a) << endl;
#define all(x) (x).begin(),(x).end()

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

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

ll factorial(ll n){
    ll t = 1;
    rep1(i, n)t *= i;
    return t;
}

ll combinations(ll n, ll k) {
    ll r = 1;
    for (ll i = 1; i <= k; ++i) {
        r *= n--;
        r /= i;
    }
    return r;
}

int main()
{
    ll n,cntl = 0,cntr = 0,cnt = 0;
    string s,ans;
    cin >> n >> s;
    rep0(i, n){
        if(s[i] == '(')++cnt;
        else{
            if(cnt){
                cnt = max(cnt - 1,0ll);
            }else{
                ++cntl;
            }
        }
    }
    cnt = 0;
    rrep0(i, n){
        if(s[i] == ')')++cnt;
        else{
            if(cnt){
                cnt = max(cnt - 1,0ll);
            }else{
                ++cntr;
            }
        }
    }
    rep0(i, cntl)ans += '(';
    ans += s;
    rep0(i, cntr)ans += ')';
    pf(ans)
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <cassert>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>

// using
using namespace std;

// typedef
typedef long long ll;
typedef unsigned long long ull;

// assert
template <typename T>
void assert_between(T val, T min, T max)
{
    assert(min <= val && val <= max);
}

// math
template <typename T>
T euclid(T a, T b)
{
    assert(a > 0 && b > 0);
    T num1 = max(a, b);
    T num2 = min(a, b);
    T mod = num1 % num2;
    return (mod == 0) ? num2 : euclid(num2, mod);
}

int n, a, b, c;
int l[8];

uint dfs(size_t depth, int al, int bl, int cl)
{
    if (depth == n) {
        if (min(al, min(bl, cl)) <= 0) {
            // A,B,Cどれかで1本も使っていない場合.
            return pow(10,9);
        }
        return abs(al - a) + abs(bl - b) + abs(cl - c) - 30; // ※A,B,C最低1本ずつ必要なので､無駄に足した30ぶんを引いている.
    }

    int cost0 = dfs(depth + 1, al, bl, cl);
    int cost1 = dfs(depth + 1, al + l[depth], bl, cl) + 10;
    int cost2 = dfs(depth + 1, al, bl + l[depth], cl) + 10;
    int cost3 = dfs(depth + 1, al, bl, cl + l[depth]) + 10;
    
    return min(cost0, min(cost1, min(cost2, cost3)));
}

int main ()
{
    scanf("%d %d %d %d", &n , &a, &b, &c);
    assert_between<int>(n, 3, 8);
    assert_between<int>(a, 1, pow(10, 3));
    assert_between<int>(b, 1, pow(10, 3));
    assert_between<int>(c, 1, pow(10, 3));

    
    for(size_t i = 0; i < n; i++)
    {
        scanf("%d", &l[i]);
        assert_between<int>(l[i], 1, pow(10, 3));
    }

    int min_cost = dfs(0, 0, 0, 0);
    printf("%d\n", min_cost);
}

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

using namespace std;

struct Edge{
	int v, a, b;
};

const int MAX = 2500;
int n, m, s;
int c[51], d[51];
long long dist[51][2510];
vector<Edge> adj[51];
priority_queue<pair<long long, pair<int, int> > > pq;
bool vis[51][2510];

void Dijkstra(){
	for(int i = 1; i <= n; i++)
		for(int j = 0; j <= MAX; j++)
			dist[i][j] = 1e18;

	dist[1][min(MAX, s)] = 0;
	pq.push({0, {1, min(MAX, s)}});

	int cnt = 0;
	while(!pq.empty()){
		long long dis; int t, u;

		dis = -pq.top().first; tie(u, t) = pq.top().second; pq.pop();

		if(vis[u][t]) continue;

		vis[u][t] = true;

		for(auto &k : adj[u]){
			if(t - k.a >= 0 && dist[k.v][t - k.a] > dis + k.b){
				++cnt;
				dist[k.v][t - k.a] = dis + k.b;
				pq.push({-dist[k.v][t - k.a], {k.v, t - k.a}});
			}
		}

		long long tp = 0;
		while(true){
			t += c[u];
			tp += d[u];

			if(dist[u][min(MAX, t)] > dis + tp){
				dist[u][min(MAX, t)] = dis + tp;
				pq.push({-(dis + tp), {u, min(MAX, t)}});
			} else break;

			if(t > MAX) break;
		}
	}

	// cout << cnt << "\n";
}

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

	cin >> n >> m >> s;

	while(m--){
		int u, v, a, b;

		cin >> u >> v >> a >> b;

		adj[u].emplace_back(Edge({v, a, b}));
		adj[v].emplace_back(Edge({u, a, b}));
	}

	for(int i = 1; i <= n; i++) cin >> c[i] >> d[i];

	Dijkstra();

	for(int i = 2; i <= n; i++){
		long long ans = 1e18;
		for(int sil = 0; sil <= MAX; sil++){
			ans = min(ans, dist[i][sil]);
		}

		cout << ans << "\n";
	}
	
	return 0;
}

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

int main(){
  int w,we[10]={1,2,4,8,16,32,64,128,256,512},i;
  queue<int> k;
  while(cin>>w){
    while(w!=0){
      k.push(w%2);
      w=w/2;
    }
    i=0;
    while(k.size()){
      if(k.front()==1&&k.size()>=2)cout<<we[i]<<" ";
      else if(k.front()==1)cout<<we[i]<<endl;
      k.pop();
      i++;
    }
  }
  return 0;
}

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

using Pair = System.Collections.Generic.KeyValuePair<int, int>;

class Program
{
	public Program() { }

	static void Main(string[] args)
	{
		new Program().prog();
	}
	Scanner cin;
	const int MOD = 1000000007;
	const int INF = int.MaxValue;
	const double EPS = 1e-7;
	const double PI = 3.1415926536;

	void prog()
	{
		cin = new Scanner();
		int[,] dir8 = new int[8, 2] { { -1, -1 }, { -1, 0 }, { -1, 1 }, { 0, -1 }, { 0, 1 }, { 1, -1 }, { 1, 0 }, { 1, 1 } };
		int[,] dir4 = new int[4, 2] { { -1, 0 }, { 0, -1 }, { 0, 1 }, { 1, 0 } };

		int N = cin.nextInt();
		int[] A = new int[N];
		for (int i = 0; i < N; i++)
		{
			A[i] = cin.nextInt();
		}
		long ans = 0;
		for (int i = 0; i < N - 1; i++)
		{
			ans += A[i] / 2;
			if (A[i] % 2 == 1 && A[i + 1] > 0)
			{
				ans++;
				A[i + 1]--;
			}
		}
		ans += A[N - 1] / 2;
		Console.WriteLine(ans);
	}
}

class Scanner
{
	string[] s;
	int i;

	char[] cs = new char[] { ' ' };

	public Scanner()
	{
		s = new string[0];
		i = 0;
	}

	public string next()
	{
		if (i < s.Length) return s[i++];
		string st = Console.ReadLine();
		while (st == "") st = Console.ReadLine();
		s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
		i = 0;
		return next();
	}

	public int nextInt()
	{
		return int.Parse(next());
	}

	public long nextLong()
	{
		return long.Parse(next());
	}

	public double nextDouble()
	{
		return double.Parse(next());
	}
}

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

int main(){
  int N; cin >> N;
  vector<int> h(N,0); for(int i = 0; i < N; i++) cin >> h.at(i);
  
  vector<int> DP(N,0);
  DP.at(1) = abs(h.at(1)-h.at(0));
  for(int i = 2; i < N; i++){
      int dh1 = abs(h.at(i)-h.at(i-1)) + DP.at(i-1);
      int dh2 = abs(h.at(i)-h.at(i-2)) + DP.at(i-2);
      DP.at(i) = min(dh1,dh2);
  }
  cout << DP.at(N-1) << endl;
}



Measured memory_bytes: 1024
#include<stdio.h>

int main()
{
	char op[1];
	int a, b;
	
	scanf("%d %c %d", &a, op, &b);

	if (op[0] == '+') {
		printf("%d", a + b);
	}
	else {
		printf("%d", a - b);
	}
	
	return 0;

}

Measured memory_bytes: 128
#include<iostream>
#include<vector>
#include<cmath>
#include<algorithm>
#include<utility>
#include<string>
#include<utility>
#include<iomanip>
#include<bitset>
#include<math.h>
using namespace std;

 
int main(){
 
	int a,b;
	cin >> a;
	
	
	cout << 3*a*a << endl;
  	
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define int long long
#define vi vector<int>
#define vii vector<vector<int> >
#define vpi vector<pair<int,int> >
#define pb push_back
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define f_ip   ios_base::sync_with_stdio(false); cin.tie(NULL);
#define ALL(x) begin(x),end(x)
using namespace std; 

#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
void err(istream_iterator<string> it)  { return ;}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a,Args... args)
{
    cerr << *it << " = " << a <<endl;
    err(++it,args...);   //args is going to end.
}

void solve()
{
    int x;cin>>x;

    int c500=x/500;     //count of 500 yen coins;
    int r500=x%500;
    int c5=r500/5;      //count of 5 yen coins;

    printf("%lld\n",c500*1000+c5*5);
}

int32_t main()
{   
     f_ip
     
     solve();

     return 0;
}


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

int main()
{
  int l, r, ans = 2019;
  cin >> l >> r;
  r = min(r, l + 2019);
  for (int i = l; i < r; i++)
    for (int j = i + 1; j <= r; j++)
      ans = min(ans, (i % 2019) * (j % 2019) % 2019);
  cout << ans << endl;
}


Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

#define REP(i, m, n) for(int i=int(m);i<int(n);i++)
#define EACH(i, c) for (auto &(i): c)
#define all(c) begin(c),end(c)
#define EXIST(s, e) ((s).find(e)!=(s).end())
#define SORT(c) sort(begin(c),end(c))
#define pb emplace_back
#define MP make_pair
#define SZ(a) int((a).size())

//#define LOCAL 1
#ifdef LOCAL
#define DEBUG(s) cout << (s) << endl
#define dump(x)  cerr << #x << " = " << (x) << endl
#define BR cout << endl;
#else
#define DEBUG(s) do{}while(0)
#define dump(x) do{}while(0)
#define BR
#endif


//改造
typedef long long int ll;
using namespace std;


//ここから編集する

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

    int res = 0;

    for(int i = 0; i < s.size(); i++){
        if(s[i] == 'g'){
            if(i % 2 == 0){

            }else{
                res++;
            }
        }else{
            if(i % 2 == 0){
                res--;
            }else{

            }
        }
    }

    cout << res << endl;

    return 0;
}


Measured memory_bytes: 512
#include<bits/stdc++.h>
#define ll long long 
#define mp make_pair 
#define pb push_back 
#define F first 
#define S second 
#define f(i,n) for(int i=0;i<n;i++) 

using namespace std;
 

void test(){
	ll n;
	cin>>n;
	ll a[n];
	f(i,n)cin>>a[i];
	ll sum = 0;
	f(i,n)sum=sum^a[i];
	
	ll b[n];
	f(i,n)b[i] = (a[i]^sum);
	f(i,n)cout<<b[i]<<" ";cout<<"\n";
	
}

int main(){
	int tests = 1;
//	cin>>tests;
	while(tests--){
		test();
	}
}

Measured memory_bytes: 6748
#include <iostream>
using namespace std;
int main() {
    char c;
    cin >> c;
    if ((c == 'a') || (c == 'u') || (c == 'i') || (c == 'o') || (c == 'e'))
        cout << "vowel" << endl;
    else cout << "consonant" << endl;
    return 0;
}

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

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int a,b;
    cin>>a>>b;
    if(a>9 || b>9 || a<1 || b<1)
    {
        cout<<-1<<endl;
        return 0;
    }
    cout<<a*b<<endl;
    return 0;
}

Measured memory_bytes: 256