akhauriyash/Code-Regression huggingface dataset:
def solve():
    n, k = map(int, input().split())
    s = input()
    k = k - 1
    n = n - 1

    res = ""
    if k-1 >= 1:
        res += s[0:k]
    res += s[k].lower()

    if k+1 <= n:
        res += s[k+1:]
    print(res)

solve()

Measured memory_bytes: 3060
use std::cmp::max;

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

fn main() {
    let _ = scan!(usize);
    let s = scan!();
    let (mut ans, mut x) = (0, 0);
    for c in s.chars() {
        if c == 'I' {
            x += 1
        } else {
            x -= 1
        }
        ans = max(ans, x);
    }
    println!("{}", ans)
}


Measured memory_bytes: 4352
#include<stdio.h>
#include<math.h>
int isprime(int);
int main(){
  int i,j,n,count=0,mat[10000],judge;
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d",&mat[i]);
  }
  for(i=0;i<n;i++){
    judge=isprime(mat[i]);
    if(judge==1)count++;
    else if(judge==2);
  }
  printf("%d\n",count);
  return 0;
}
int isprime(int x){
  int i;
  double a;
  if(x==2)return 1;
  if(x<2||x%2==0)return 2;
  i=3;
  a=sqrt(x);
  while(i<=a){
    if(x%i==0)return 2;
    i=i+2;
  }
  return 1;
}



Measured memory_bytes: 2108
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define rep(i, n) FOR(i, 0, n)
#define rep1(i, n) FOR(i, 1, n+1)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; --i)
#define whole(x) (x).begin(),(x).end()
#define rwhole(x) (x).rbegin(), (x).rend()
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end())
#define P pair<int, int>
#define debug(var) cerr << "[" << #var << "] " << var << endl
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define vi vector<int>
#define vl vector<ll>
#define pb push_back
#define eb emplace_back
const ll mod = 1000000007;
const int dx[] = {-1,0,1,0};
const int dy[] = {0,-1,0,1};
 
struct Query {
    int l, r, i;
    Query(int l, int r, int i): l(l), r(r), i(i){}
};
 
template<typename T>
struct BIT {
  int n;
  vector<T> d;
  BIT(int n=0):n(n),d(n+1) {}
  void add(int i, T x=1) {
    for (i++; i <= n; i += i&-i) {
      d[i] += x;
    }
  }
  T sum(int i) {
    T x = 0;
    for (i++; i; i -= i&-i) {
      x += d[i];
    }
    return x;
  }
  T sum(int l, int r) {
    return sum(r-1) - sum(l-1);
  }
};
 
int main(){
    int n, q;
    cin >> n >> q;
    vector<int> c(n);
    rep(i, n) cin >> c[i];
    vector<Query> query;
    rep(qi, q) {
        int l, r;
        cin >> l >> r;
        l--; r--;
        query.eb(l, r, qi);
    }
    auto comp = [](Query a, Query b) {
        return a.l<b.l;
    };
    sort(whole(query), comp);
    reverse(whole(query));
    vector<int> ans(q);
    vector<int> pi(n+1, -1);
    vector<P> p;
    rep(i, n) {
        int prev = pi[c[i]];
        if (prev!=-1) {
            p.emplace_back(prev, i);
        }
        pi[c[i]] = i;
    }
    BIT<int> bit(n+5);
    sort(whole(p));
    reverse(whole(p));
    int index = 0;
 
    rep(i, q) {
        int l = query[i].l;
        int r = query[i].r;
        int qi = query[i].i;
        while (index<p.size()) {
            if (p[index].first<l) break;
            bit.add(p[index].second, 1);
            index++;
        }
        int a = bit.sum(r);
        ans[qi] = r - l + 1- a;
    }
 
    rep(i, q) printf("%d\n", ans[i]);
    return 0;
}

Measured memory_bytes: 23104
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr


def cmb(n, r):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod

mod = 10**9+7 #出力の制限
N = 2*10**5
g1 = [1, 1] # 元テーブル
g2 = [1, 1] #逆元テーブル
inverse = [0, 1] #逆元テーブル計算用テーブル

for i in range( 2, N + 1 ):
    g1.append( ( g1[-1] * i ) % mod )
    inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
    g2.append( (g2[-1] * inverse[-1]) % mod )



n,m=map(int,input().split())
if m==1:
  print(1)
  exit()
A=factorization(m)
ans=1
for i in range(len(A)):
  ans=ans*cmb(n+A[i][1]-1,A[i][1])%mod
print(ans)

Measured memory_bytes: 27096
def func(x_list, num):
    total = sum([(x - num)**2 for x in x_list])
    return total

N = int(input())
x_list = list(map(int, input().split()))
max_x = max(x_list)
min_num = func(x_list, 1)

for i in range(2, max_x+1):
    tmp = func(x_list, i)
    if min_num > tmp:
        min_num = tmp

print(min_num)


Measured memory_bytes: 3060
#include <iostream>
#include <stdio.h>
#include <string>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <string.h>
#include <vector>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <time.h>
//#define int long long
#define ll long long
#define us unsigned
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rrep(i, n) for (int i = (n)-1; i >= 0; ++i)
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define nin(ary, n) for (int i = 0; i < (n); i++) cin >> ary[i]
#define nnin(ary, h, w) for (int i = 0; i < (h); ++i) for (int j = 0; j < (w); ++j) cin >> ary[i][j]
#define opt(conditions, a, b) cout << ((conditions) ? #a : #b) << endl
using namespace std;
const double PI = acos(-1.0);
const int MOD = 1e9 + 9;

int max_n(int ary[], int length) {
	int max = ary[0];
	for (int i = 1; i < length; i++)
		if (max < ary[i]) max = ary[i];
	return max;
}

int max_o(int ary[], int length) {
	int max;
	max = max_n(ary, length);
	for (int i = 0; i < length; i++) {
		if (ary[i] == max) return i;
	}
	return -1;
}

int min_n(int ary[], int length) {
	int min = ary[0];
	for (int i = 1; i < length; i++)
		if (min > ary[i]) min = ary[i];
	return min;
}

int min_o(int ary[], int length) {
	int min;
	min = min_n(ary, length);
	for (int i = 0; i < length; i++) {
		if (ary[i] == min) return i;
	}
	return -1;
}

int gcm(int a, int b) {
	int result = a;
	int k = 0;
	int n = b;
	do {
		k = result % n;
		result = n;
		n = k;
	} while (k != 0);
	return result;
}

int gcm_n(int ary[], int length) {
	int g = ary[0];
	for (int i = 0; i < length; i++)
		g = gcm(g, ary[i]);
	return g;
}

int lcm(int a, int b) {
	int g, n;
	g = gcm(a, b);
	n = gcm(a, g);
	a = a / n;
	b = b / (g / n);
	return a*b;
}

int lcm_n(int ary[], int length) {
	int l = ary[0];
	for (int i = 0; i < length; i++)
		l = lcm(l, ary[i]);
	return l;
}

signed main() {
	
	int a, b;
	cin >> a >> b;
	cout << max(0, a - b) << endl;
	return 0;
}

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

#define            ll              long long
#define            pb              push_back
#define            mp              make_pair
#define            loop(i,a,n)     for(int i=a;i<=n;++i)
#define            clr(x)          memset(x,0,sizeof x)
#define            min3(a,b,c)     min(a,min(b,c))
#define            max3(a,b,c)     max(a,max(b,c))
#define            min4(a,b,c,d)   min(a,min(b,min(c,d)))
#define            max4(a,b,c,d)   max(a,max(b,max(c,d)))
#define            fast            ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define            pii             pair<int,int>
#define            pll             pair<ll,ll>
#define            pli             pair<ll,int>
#define            pil             pair<int,ll>
#define            FF              first
#define            SS              second
#define            PI              acos(-1.0)
#define            bug             cout<<"ok"<<endl;

using namespace std;
using namespace __gnu_pbds;

typedef tree<int , null_type,less<int>,
       rb_tree_tag, tree_order_statistics_node_update> anik;

const int MOD = 1e9 + 7;
const ll MX= 1e9;
const ll INF = 1e9;

main()
{
   int n;
   cin>>n;
   for(int i=1;i<10;++i)
   {
       if(n%i==0 && n/i<10)return cout<<"Yes",0;
   }
   cout<<"No"<<endl;
}


Measured memory_bytes: 3648
#include <bits/stdc++.h>
using namespace std;
typedef long long int lld;
typedef vector<lld> vi;
typedef pair<lld,lld> pi;
#define F first
#define S second
#define MOD 1000000007
#define PB push_back
#define MP make_pair
#define rep(i,a,b) for (lld i = a; i < b; i++)
lld r,j,l,x,y,m,b,n,s,f,q,i,z,p,c,k,d,t,u,e,g;string s1,s2,s3,s4;
int main()
{
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  lld a[3][3];
  rep(i,0,3)
  {
    rep(j,0,3)
    cin>>a[i][j];/*
    p=n-(500*i);
    if(p<=a&&p>=0)
    {
      cout<<"Yes";return 0;
    }*/
  }/*sort(a,a+n);p=0;
  for(i=n-1;i>=0;i--)
  {
    if(p%2==0)
    {
      c+=a[i];
    }
    else
    {
      d+=a[i];
    }
    p++;
    //cout<<"No";
  }
  cout<<c-d;*/
    p=a[0][1]-a[0][0];
    q=a[1][1]-a[1][0];
    r=a[2][1]-a[2][0];
    if(p==q&&q==r)
    {
      p=a[0][2]-a[0][0];
    q=a[1][2]-a[1][0];
    r=a[2][2]-a[2][0];
    if(p==q&&q==r)
    {
      cout<<"Yes";
    }
    else
      cout<<"No";
    }
    else
    {
      cout<<"No";
    }
} 

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

#define int long long
#define MAX_N (200005)
#define INF (1LL<<60)
#define EPS (1e-7)
#define DEBUG(x) cerr << #x <<":"<< x << endl;
#define DEBUGVC(x) cerr << #x <<": "; for(auto p:(x)) cerr << p <<" "; cerr << endl;
#define DEBUGVCP(x) for(auto p:(x)) cerr << #x <<": "<< p.first <<", "<< p.second << endl;
#define DEBUG2(x, y) cerr << #x <<" : "<< x <<", "<< #y <<" : "<< y << endl;
#define DEBUG3(x, y, z) cerr << #x <<" : "<< x <<", "<< #y <<" : "<< y <<", "<< #z <<" : "<< z << endl;
const int MOD = (int)1e9+7;


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

    int cnt=0;
    for(int i=0; i<s.length(); i++){
        if(s[i]=='o') cnt++;
    }

    int m = 15 - s.length();

    if(m+cnt >= 8) cout << "YES" << endl;
    else cout << "NO" << endl;

}

Measured memory_bytes: 256
import java.util.*;
 
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        List<List<Shogen>> list = new ArrayList<>();
        for (int i = 0; i < N; i++) {
            List<Shogen> s = new ArrayList<>();
            list.add(s);
            int A = sc.nextInt();
            for (int j = 0; j < A; j++) {
                int x = sc.nextInt()-1;
                int y = sc.nextInt();
                s.add(new Shogen(x, y));
            }
        }

        int ans = 0;
        int bit = 1 << N;
        for (int i = 0; i < bit; i++) {
            if (ok(list, i)) {
                int count = 0;
                int tmp = i;
                while (tmp > 0) {
                    if (tmp%2 == 1) {
                        count++;
                    }
                    tmp /= 2;
                }
                ans = Math.max(ans, count);
            }
        }

        System.out.println(ans);
    }

    private static boolean ok(List<List<Shogen>> list, int bit) {
        int i  = 0;
        int tmp = bit;
        while (tmp > 0) {
            if (tmp%2 == 1) {
                // check
                List<Shogen> ss = list.get(i);
                for (Shogen s: ss) {
                    if ((s.y == 1 && (bit>>s.x)%2 == 1)
                        || (s.y == 0 && (bit >> s.x)%2 == 0)) {
                        // OK
                    } else {
                        return false;
                    }
                }
            }
            tmp /= 2;
            i++;
        }
        return true;
    }

    private static class Shogen {
        int x;
        int y;
        Shogen(int x, int y) {
            this.x = x;
            this.y = y;
        }
    }
}



Measured memory_bytes: 25428
/* 
	Author: ankrypt
*/


#include <bits/stdc++.h>

using namespace std;

#define MOD 1000000007
#define ll long long int
#define u64 unsigned long long int

ll R;

int main() {
	scanf("%lld", &R);
	cout << R * R << "\n";
	return 0;
}
/*
	Powered by Buggy Plugin
*/


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

using namespace std;
typedef long long ll;

#define REP(i, n) for (ll i = 0; i < (n); i++)
#define REPR(i, n) for (ll i = (n); i >= 0; i--)
#define FOR(i, m, n) for (ll i = (m); i < (n); i++)
#define FORR(i, m, n) for (ll i = (m); i >= (n); i--)
#define INF 1e9
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((ll)(x).size())
#define SORT(x) sort((x).begin(), (x).end())
#define dump(x) cerr << #x << " = " << (x) << endl
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" \
                      << " " << __FILE__ << endl

int main(int argc, char const *argv[])
{
    ll a, b, c, x, y;
    cin >> a >> b >> c >> x >> y;
    ll res = INF;
    REP(i, max(x, y) + 1)
    {
        ll tmp = i * 2 * c;
        if (x > i)
            tmp += (x - i) * a;
        if (y > i)
            tmp += (y - i) * b;
        // dump(res);
        // dump(tmp);
        res = min(res, tmp);
    }
    cout << res << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
int a,b,c,d,ans;
int main(){
        cin >> a >> b;
        for(int i=a; i<=b; i++) {
                string s=to_string(i);
                c=s.size();
                d=c/2;
                string k=s.substr(0,d);
                reverse(s.begin(),s.end());
                string l=s.substr(0,d);
                if(k==l) ans++;
        }
        cout << ans << endl;
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
#define REP(i,n) for(int i = 0;i < (n);i++)
#define P pair<int,int>
#define pb push_back
#define mk make_pair
using namespace std;
const int INF = 1e9;

typedef long long ll;

#define MAX_V 100001

struct edge {
    int to;
    int cost;
};

int d[MAX_V];
bool f;
int V;
vector<edge> G[MAX_V];
bool mem[MAX_V];
void DFS(int u){
  mem[u] = true;

  //writing method

  //method end

  REP(i,G[u].size()){
    
    if(!mem[G[u][i].to]){
      d[G[u][i].to] = d[u]+G[u][i].cost;
      DFS(G[u][i].to);
    }
    else{
      if(d[G[u][i].to] != d[u]+G[u][i].cost){
	//cout <<u<<"  " << i << endl;
	f = false;
      }
    }
  }
}


int main(){
  int E,r;
  f = true;
  cin >> V >> E;
  REP(i,E){
    int f,t,c;
    cin >> f >> t >> c;
    f--;
    t--;
    edge e = {t,c};
    G[f].pb(e);
    e.cost = -1*c;
    e.to = f;
    G[t].pb(e);
  }
 
  REP(i,MAX_V){
    mem[i] = false;
  }
  
  for(int i = 1;i <= V;i++){
    if(!mem[i]){
      d[i] = 0;
      DFS(i);
    }
  }
  if(f)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
  
  return 0;
}


Measured memory_bytes: 12032
#include <stdio.h>
#include <math.h>
int main(){
	int data[3],d1,d2,d3,i;
	for(i = 0;i < 3;i++){
		scanf("%d",&data[i]);
	}
//	scanf("%d %d %d",&data[0],&data[1],&data[2]);
	if(data[0] > data[1]){
		d1 = data[0];
		data[0] = data[1];
		data[1] = d1;
	}
	if(data[1] > data[2]){
		d1 = data[1];
		data[1] = data[2];
		data[2] = d1;
	}
	if(data[0] > data[1]){
		d1 = data[0];
		data[0] = data[1];
		data[1] = d1;
	}
	
		printf("%d %d %d\n",data[0],data[1],data[2]);
	return 0;
}

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

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

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

    int c0 = 0;
    int c1 = 0;
    int c2 = 0;
    int c3 = 0;
    for(int i = 0; i < n; i++){
        if(s[i] == "AC"){
            c0++;
        }else if(s[i] == "WA"){
            c1++;
        }else if(s[i] == "TLE"){
            c2++;
        }else{
            c3++;
        }
    }

    cout << "AC" << " " << "x" << " " << c0 << endl;
    cout << "WA" << " " << "x" << " " << c1 << endl;
    cout << "TLE" << " " << "x" << " " << c2 << endl;
    cout << "RE" << " " << "x" << " " << c3 << endl;

    return 0;
}

Measured memory_bytes: 6744
#include <iostream>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <climits>
#include <cmath>
#include <utility>
#include <string>
#include <cstring>
#include <functional>

using namespace std;

int n;

int main() {

	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	
    int n;
    cin >> n;
    cout << (n+1) / 2 << endl;

	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a = b; return 1; } return 0; }

int N, A[10101];
//---------------------------------------------------------------------------------------------------
void _main() {
	while (cin >> N) {
		if (N == 0) return;
		rep(i, 0, N) cin >> A[i];

		int sm = 0;
		rep(i, 0, N) sm += A[i];

		int ans = 0;
		rep(i, 0, N) if (A[i] * N <= sm) ans++;
		printf("%d\n", ans);
	}
}



Measured memory_bytes: 3224
// Prim
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <climits>
#define MAX_N 200
using namespace std;

const int INF = 1e+9;

int main(){
	int n, m;
	int from, to, d;
	int cost[MAX_N][MAX_N];
	int minCost[MAX_N];
	bool used[MAX_N];
	int ans;

	while (cin >> n) {
		if (n == 0) {
			break;
		}
		cin >> m;
		// initialize
		for (int y = 0; y < n; y++) {
			minCost[y] = INF;
			used[y] = false;
			for (int x = 0; x < n; x++) {
				cost[y][x] = INF;
			}
		}
		for (int i = 0; i < m; i++) {
			scanf("%d,%d,%d", &from, &to, &d);
			cost[to][from] = cost[from][to] = d / 100 -1;
			//cout << from << ',' << to << ',' << d << endl;
		}
		minCost[0] = 0;
		ans = 0;
		// Prim
		while (1) {
			int v = -1;
			// find minNode
			for (int i = 0; i < n; i++) {
				if(!used[i] && (v == -1 || minCost[i] < minCost[v])){
					v = i;
				}
			}
			if (v == -1) { // all noses are used?
				break;
			}
			used[v] = true;
			ans += minCost[v];

			for (int i = 0; i < n; i++) {
				minCost[i] = min(minCost[i], cost[v][i]);
			}
		}
		cout << ans << endl;
	}
	return 0;
}

Measured memory_bytes: 0
//#include <bits/stdc++.h>
#include <iostream>
#include <algorithm>
#include <string>
using namespace std;
#define endl '\n'


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

	while (cin >> n)
	{
		long long sum = 0;
		for (long long i = 1; i <= n; i++)
		{
			if (i % 3 != 0 && i % 5 != 0)
				sum += i;
		}
		cout << sum << endl;
	}
	//system("pause");
	return 0;
}



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

bool IsPrime(int n)
{
    for (int i = 2; i <= sqrt(n); ++i) {
        if (n % i == 0) {
            return false;
        }
    }
    return true;
}

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

    int ans = 0;
    for (int i = 0; i < n; ++i) {
        int x;
        cin >> x;
        if (IsPrime(x)) {
            ++ans;
        }
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 3096
#include<bits/stdc++.h>
using namespace std;
#define int long long int
vector<int> v;
int n, s;
int dp[3010][3010];
int mod = 998244353;

int solve(int ind, int sum)
{
    // cout << ind << " " << sum << endl;
    if(sum < 0)
    {
        // cout << 0 << endl;
        return 0;
    }
    if(sum == 0)
    {
        // cout << (n-ind) << endl;
        return (n-ind + 1);
    }
    if(ind >= n)
    {
        // cout << 0 << endl;
        return 0;
    }
    if(dp[ind][sum] != -1)
        return dp[ind][sum];

    // cout << ind << " " << sum << endl;
    int ans = 0;
    if(sum == s)
    {
        ans = ans + (ind+1) * solve(ind+1, sum-v[ind]) + solve(ind+1, sum);
        ans = ans % mod;
    }
    else
    {
        ans = ans + solve(ind+1, sum) + solve(ind+1, sum-v[ind]);
        ans = ans % mod;
    }

    return dp[ind][sum] = ans;
}

int32_t main()
{
    cin >> n >> s;
    v.resize(n);
    for(int i=0; i<n; i++)
        cin >> v[i];
    memset(dp, -1, sizeof dp);
    cout << solve(0, s) << endl;
    return 0;
}


Measured memory_bytes: 71168
n = int(input())
s=[]
t=[]
for _ in range(n):
  tmp = input().split()  
  s.append(tmp[0])
  t.append(int(tmp[1]))
x = input() 

count_flag = False
ans = 0
for i in range(n):
  if count_flag :
    ans+= t[i]
  if s[i]==x:
    count_flag = True  
    
print(ans)    

Measured memory_bytes: 3064
#include <stdio.h>
#define _USE_MATH_DEFINES
#include <math.h>
#include <vector>
#include <algorithm>
#include <map>

using namespace std;

int main(){
    long n;
    scanf("%ld", &n);
    vector<long> viCount(n,0);
    vector<pair<long, long> > viiEdge;
    for(long i = 0; i < n-1; i++){
        long a,b;
        scanf("%ld %ld", &a, &b);
        a--;
        b--;
        viCount[a]++;
        viCount[b]++;
        viiEdge.push_back(make_pair(a, b));
    }
    
    vector<long> viNum(n);
    for(long i = 0; i < n; i++){
        scanf("%ld", &viNum[i]);
    }
    sort(viNum.begin(), viNum.end());
    long nSum = 0;
    for(long i = 0; i < n-1; i++){
        nSum += viNum[i];
    }
    printf("%ld\n", nSum);    
  
    long k = 0;
    vector<long> viAns(n);
    while(k < n - 1){
        for(long i = 0; i < n; i++){
            if(viCount[i] == 1){
                viAns[i] = viNum[k];
                k++;
                if(k == n - 1){
                    break;
                }
                viCount[i]--;
                long j;
                long iPair;
                for(j = 0; j < viiEdge.size(); j++){                    
                    if(viiEdge[j].first == i){
                        iPair = viiEdge[j].second;
                        viiEdge.erase(viiEdge.begin() + j);
                        break;
                    }
                    if(viiEdge[j].second == i){
                        iPair = viiEdge[j].first;
                        viiEdge.erase(viiEdge.begin() + j);
                        break;
                    }
                }
                viCount[iPair]--;
            }
        }
    }
    for(long i = 0; i < n; i++){
        if(viAns[i] == 0){
            viAns[i] = viNum[n-1];
        }
        printf("%ld ", viAns[i]);
    }
    return 0;
}


Measured memory_bytes: 3472
import sys

n, *b = map(int, sys.stdin.read().split())

def main():
    on = 1
    lightened = set([1])
    for i in range(1, n):
        on = b[on-1]
        if on == 2:
            return i
        if on in lightened:
            return -1
        lightened.add(on) 

if __name__ == '__main__':
    ans = main()
    print(ans)

Measured memory_bytes: 15204
#include "bits/stdc++.h"
#include<unordered_map>
#include<unordered_set>
#pragma warning(disable:4996)
using namespace std;
using ld = long double;
template<class T>
using Table = vector<vector<T>>;
const ld eps=1e-9;

//// < "D:\D_Download\Visual Studio 2015\Projects\programing_contest_c++\Debug\a.txt"

string to_string_keta(const long long int l,const int keta) {
	ostringstream oss;

	oss << std::setw(keta)<<std::setfill('0')  << l;

	return oss.str();
}

int main() {
	while (1) {
		int N; cin >> N;
		if (!N)break;
		if (N % 1111 == 0) {
			cout << "NA" << endl;
			continue;
		}
		int num = 0;
		while (1) {
			if (N == 6174)break;
			string st(to_string_keta(N, 4));
			sort(st.begin(), st.end());
			int amin(stoi(st));
			reverse(st.begin(), st.end());
			int amax(stoi(st));
			N = amax - amin;
			num++;

		}
		cout << num << endl;
	}
	
	return 0;
}

Measured memory_bytes: 3144
#include<bits/stdc++.h>
#define int long long
#define endl '\n'
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define bug1( x ) {cerr << (#x) <<"="<< x << endl;}
#define bug2( x , y ) {cerr << (#x) <<"="<< (x) << "    " << (#y) << "="<< (y) << endl;}
#define bug3( x , y , z ) {cerr << (#x) <<"="<<(x) << "    " << (#y) <<"="<< (y) << "    " << (#z) <<"="<< (z) << endl;}
#define bug4( x , y , z , w) {cerr << (#x) <<"="<<(x) << "    " << (#y) <<"="<< (y) << "    " << (#z) <<"="<< (z) << "    " << (#w) <<"="<< w << endl;}
#define bug5( x , y , z , w ,p) {cerr << (#x) <<"="<<(x) << "    " << (#y) <<"="<< (y) << "    " << (#z) <<"="<< (z) << "    " << (#w) <<"="<< w << "    " << (#p) <<"="<< p << endl;}
#define bug6( x , y , z , w ,p , q) {cerr << (#x) <<"="<<(x) << "    " << (#y) <<"="<< (y) << "    " << (#z) <<"="<< (z) << "    " << (#w) <<"="<< w << "    " << (#p) <<"="<< p << "    " << (#q) <<"="<< q << endl;}
#define bugn( x , n ) {cerr << (#x) <<":";for(int i=0;i<n;i++)cerr << x[i] <<"  "; cerr << endl;}
#define bugnm( x , n , m ) {cerr << (#x)<<endl;for(int i=0;i<n;i++){cerr << "Row #" << i<< ":";for(int j=0;j<m;j++)cerr << x[i][j] << "   ";cerr << endl;}}
typedef long long ll;
typedef long double ld;
using namespace std;


const int maxn = 2e5+10, mod=998244353;
vector<int>t(maxn<<2);
int n,m;
void update(int rt,int l,int r,int pos,int new_val){
	if(l==r){t[rt]=new_val;return;}
	if(pos<=((l+r)>>1))update(rt<<1,l,(l+r)>>1,pos,new_val);
	else update((rt<<1)+1,((l+r)>>1)+1,r,pos,new_val);
	t[rt]=max(t[rt<<1],t[(rt<<1)+1]);
}
int query(int rt,int tl,int tr,int l,int r){
	if(l>r)return 0;
	if(l==tl&&r==tr)return t[rt];
	return max(query(rt<<1,tl,(tl+tr)>>1,l,min(r,(tl+tr)>>1)),query((rt<<1)+1,((tl+tr)>>1)+1,tr,max(l,((tl+tr)>>1)+1),r));
}

int32_t main(){
	IOS
	int n;cin>>n;
	vector<pair<int,int>>a(n);
	for(int i=0;i<n;i++){
		cin>>a[i].first>>a[i].second;
		a[i].second+=a[i].first-1;
	}
	sort(a.begin(),a.end());
	vector<int>dp(n+1);
	dp[n]=1;
	for(int i=n-1;i>=0;i--){
		int l=i,r=n-1,idx=i;
		while(l<=r){
			int m=(l+r)>>1;
			if( a[m].first <= a[i].second ){
				idx=max(idx,m);
				l=m+1;
			}else{
				r=m-1;
			}
		}
	    idx=max(idx,query(1,0,n-1,i,idx));
		update(1,0,n-1,i,idx);
		
		dp[i]=dp[idx+1];
		dp[i]+=dp[i+1];
		dp[i]%=mod;
	}
	cout<<dp[0];
	
	
}
/*
 * long long or int?
 * index out of bound? 
 * Tested on own test case?corner?
 * Make more general solution.
 * Read Read Read Read ....
 */


Measured memory_bytes: 14276
#include<stdio.h>
#define INFTY 2000000000

int S[1000000001];
int count=0;

void merge(int left, int mid, int right){
    int n1=mid-left;
    int n2=right-mid;
    int L[n1+1], R[n2+2];
    
    for(int i=0;i<n1;i++) L[i]=S[left+i];
    for(int i=0;i<n2;i++) R[i]=S[mid+i];
    L[n1]=INFTY;
    R[n2]=INFTY;
    int i=0;
    int j=0;
    for(int k=left;k<right;k++){
        count++;
        if(L[i]<=R[j]){
            S[k]=L[i];
            i++;
        }
        else{
            S[k]=R[j];
            j++;
        }
    }
}

void mergeSort(int left, int right){
    if(left+1<right){
        int mid=(left+right)/2;
        mergeSort(left,mid);
        mergeSort(mid,right);
        merge(left,mid,right);
    }
}

int main(void){
    int n;
    
    scanf("%d",&n);
    for(int i=0;i<n;i++){
        scanf("%d",&S[i]);
    }
    
    mergeSort(0,n);
    
    for(int i=0;i<n;i++){
        printf("%d",S[i]);
        if(i!=n-1) printf(" ");
        else printf("\n%d\n",count);
    }
    
    return 0;
}


Measured memory_bytes: 5648
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cinttypes>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iostream>
#include <limits>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <vector>
using namespace std;

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  
  int N;
  int64_t C;
  cin >> N >> C;
  
  vector<int64_t> X(N);
  vector<int64_t> V(N);
  for (int i = 0; i < N; ++i) {
    cin >> X[i] >> V[i];
  }
  
  vector<int64_t> l(N), ml(N);
  l[0] = V[0] - X[0];
  ml[0] = l[0];
  for (int i = 1; i < N; ++i) {
    l[i] = l[i - 1] + V[i] - (X[i] - X[i - 1]);
    ml[i] = max(ml[i - 1], l[i]);
  }
  
  vector<int64_t> r(N), mr(N);
  r[N - 1] = V[N - 1] - (C - X[N - 1]);
  mr[N - 1] = r[N - 1];
  for (int i = N - 2; i >= 0; --i) {
    r[i] = r[i + 1] + V[i] - (X[i + 1] - X[i]);
    mr[i] = max(mr[i + 1], r[i]);
  }
  
  int64_t result = 0;
  result = max(result, ml[N - 1]);
  result = max(result, mr[0]);
  
  for (int i = 0; i < N - 1; ++i) {
    int64_t cand = l[i] + mr[i + 1] - X[i];
    result = max(result, cand);
  }
  for (int i = N - 1; i > 0; --i) {
    int64_t cand = r[i] + ml[i - 1] - (C - X[i]);
    result = max(result, cand);
  }
  
  cout << result << '\n';
    
  return 0;
}


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


int main(){
  stack<int> s;
  string str;
  while(cin >> str){
    if(str == "+"){
      int a = s.top(); s.pop();
      int b = s.top(); s.pop();
      s.push(a + b);
    }
    else if(str == "-"){
      int a = s.top(); s.pop();
      int b = s.top(); s.pop();
      s.push(- a + b);
    }
    else if(str == "*"){
      int a = s.top(); s.pop();
      int b = s.top(); s.pop();
      s.push(a * b);
    }
    else{
      int a = stoi(str);
      s.push(a);
    }
  }
  cout << s.top() << endl;
}



Measured memory_bytes: 3200
#include <iostream>
#include<bits/stdc++.h>
using namespace std;
bool compare(pair<long long int,long int> a,pair<long long int,long int> b)
{
    return a.second<b.second;
}
int main()
{
    long int n,l;
    cin>>n>>l;
    long int a[n];
    long int kk=0;
    for(long int i=0;i<n;i++)
    {
        a[i]=l+i;
        kk+=a[i];
    }
    long int ans=INT_MAX,ans1;
    for(long int i=0;i<n;i++)
    {
        if(abs(a[i])<abs(ans))
        {
          ans=a[i];
        }
    }
    cout<<kk-ans;
}

Measured memory_bytes: 256
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <queue>
#include <stack>
#include <cstdio>
#include <string>
#include <vector>
#include <complex>
#include <cstdlib>
#include <cstring>
#include <numeric>
#include <sstream>
#include <iostream>
#include <algorithm>
#include <functional>
  
#define mp       make_pair
#define pb       push_back
#define all(x)   (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)
  
using namespace std;
  
typedef    long long          ll;
typedef    unsigned long long ull;
typedef    vector<bool>       vb;
typedef    vector<int>        vi;
typedef    vector<vb>         vvb;
typedef    vector<vi>         vvi;
typedef    pair<int,int>      pii;
  
const int INF=1<<29;
const double EPS=1e-9;
  
const int dx[]={1,0,-1,0,1,1,-1,-1},dy[]={0,-1,0,1,1,-1,-1,1};
 

int main() {
  int A, B;
  cin >> A >> B;
  if (A % 3 == 0 || B % 3 == 0 || (A + B) % 3 == 0) {
    cout << "Possible" << endl;
  } else {
    cout << "Impossible" << endl;
  }
  return 0;
}

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

// for loop
#define rep(i,a,n) for(int i=(a);i<(n);++i)
#define repe(i,a,n) for(int i=(a);i<=(n);++i)
#define rrep(i,n,a) for(int i=(n);n>(a);--i)
#define rrepe(i,n,a) for(int i=(n);n>=(a);--i)

// abbreviati
#define PB(v) push_back(v)
#define MP(A,B) make_pair(A,B)
#define F first
#define S second
#define all(v) v.begin(),v.end()
#define ENDL << "\n"

using ll = long long;
using P = pair<int,int>;
using itn = int;

// constant
const int INF = 1<<30;
const ll INFLL = 1LL << 60;
const ll MOD = 1000000007;
const long double PI =(acos(-1));

/***Snippet***************************************************
ifelse, isprime, torad, todeg, lcm, bfs,chmin,chmax
**************************************************************/

// adjacency list
vector<int> to[100005];

// Graph
using Graph = vector<vector<int>>;

// Grid
int H,W;
vector<vector<int>> field;

// 4方向への移動ベクトル
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};


int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int n; cin >> n;
    vector<pair<string,pair<int,int>>> vp(n);
    rep(i,0,n){
        string s;
        int p;
        cin >> s >> p;
        vp[i].first=s;
        vp[i].second.first=-p;
        vp[i].second.second=i+1;
    }
    sort(vp.begin(),vp.end());
    rep(i,0,n){
        cout << vp[i].second.second ENDL;
    }
    
    return 0;
}

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

using namespace std;

typedef pair<int, int> P;

/*class node{
public:
    int l, r, i;
    bool operator<(int a) const{
        return l < a;
    }
};*/

int main()
{
    int N, M, Q;
    cin >> N >> M >> Q;
    vector<int> p(M), q(M);
    vector<P> LR(M);
    vector< vector<int> > bucket(N, vector<int>(N));
    int l, r;
    for(int i=0;i<M;++i){
        cin >> l >> r;
        LR[i].first = --l;
        LR[i].second = --r;
    }
    for(int i=0;i<Q;++i){
        cin >> l >> r;
        p[i] = --l;
        q[i] = --r;
    }

    for(int i=0;i<N;++i){
        for(int j=0;j<M;++j){
            if(LR[j].first >= i){
                // lがi以上のもので、rの個数を数える。
                ++bucket[i][LR[j].second];
            }
        }
        for(int k=0;k<N-1;++k){
            bucket[i][k+1] += bucket[i][k];
        }
    }

    for(int i=0;i<Q;++i){
        cout << bucket[p[i]][q[i]] << endl;
    }
}


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

#define ll long long

int main(){
    int n,c=0;
    cin >> n;
    vector<int> a;
    for(int i=0; i<n; i++){
        int val;
        cin >> val;
        a.push_back(val);
    }
    int j=0, now=1;
    for(;;){
            now = a[now-1];
            if(now == 2){
                cout << c+1;
                break;
            }
            if(c>=n){
                cout << "-1";
                break;
            }
        c++;
    }

}

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

int main() {
    int n;
    cin >> n;
    vector<int> h(n);
    for (int i = 0; i < n; ++i) {
        cin >> h[i];
    }
    int ans = 0;
    while(1){
        bool f = false;
        for(int i = 0; i < n; ++i){
            if(h[i]){
                f = true;
                h[i]--;
            }
            else if(f) break;
        }
        if(!f) break;
        ans++;
    }
    cout << ans << endl;
    
}

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

int main(){
	int x, y, two, four;
	cin >> x >> y;
	if(y < 2*x or y > 4*x){
		cout << "No\n";
	}
	else{
		y = y - 2 * x;
		if(y%2 == 0){
			cout << "Yes\n";
		}
		else{
			cout << "No\n";
		}
	}
	return 0;
}

Measured memory_bytes: 3628
#define _CRT_SECURE_NO_WARNINGS
#include <bits/stdc++.h>
#include <random>
using namespace std;
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define sz(x) ((int)(x).size())
typedef vector<int> vi;
typedef long long ll;
typedef pair<int, int> pii;
typedef double db;
mt19937 mrand(random_device{}());
const ll mod = 998244353;
int rnd(int x) { return mrand() % x; }
ll powmod(ll a, ll b) { ll res = 1; a %= mod; assert(b >= 0); for (; b; b >>= 1) { if (b & 1)res = res * a%mod; a = a * a%mod; }return res; }
ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
// head

const int MAXN = 100000 + 5;
int N, M;
int A[MAXN];

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	//	freopen("a.in","r",stdin);
	//	freopen("a.out","w",stdout);
	cin >> N >> M;
	rep(i, 0, M) cin >> A[i];

	int odd[2];
	int cnt = 0;
	bool flag = true;
	rep(i, 0, M)
	{
		if (A[i] & 1) {
			if (cnt == 2) {
				flag = false;
				break;
			}
			odd[cnt++] = i;
		}
	}

	if (!flag) cout << "Impossible" << endl;
	else {
		if (cnt == 0) {
			rep(i, 0, M)
			{
				if (i) cout << " ";
				cout << A[i];
			}
			cout << endl;

			if (A[0] == 2) {
				cout << M + 1 << endl;
				cout << 1;
				rep(i, 1, M)
				{
					cout << " ";
					cout << A[i];
				}
				cout << " " << 1 << endl;
			}
			else {
				cout << M + 2 << endl;
				cout << A[0] - 2 << " " << 1;
				rep(i, 1, M)
				{
					cout << " ";
					cout << A[i];
				}
				cout << " " << 1 << endl;
			}

		}
		else if (cnt == 1) {
			cout << A[odd[0]];
			rep(i, 0, M)
			{
				if (odd[0] == i) continue;
				cout << " ";
				cout << A[i];
			}
			cout << endl;

			bool ffg = false;
			if (A[odd[0]] > 1) {
				cout << M + 1 << endl;
				cout << A[odd[0]] - 1;
				ffg = true;
			}
			else {
				cout << M << endl;
			}
			rep(i, 0, M)
			{
				if (odd[0] == i) continue;
				if(ffg) cout << " ";
				ffg = true;
				cout << A[i];
			}
			cout << " " << 1 << endl;
		}
		else {
			cout << A[odd[0]];
			rep(i, 0, M)
			{
				if (odd[0] == i || odd[1] == i) continue;
				cout << " ";
				cout << A[i];
			}
			cout << " " << A[odd[1]] << endl;

			bool ffg = false;
			if (A[odd[0]] > 1 && A[odd[1]] > 1) {
				cout << M + 1 << endl;
				cout << A[odd[0]] - 1;
				ffg = true;
			}
			else if(A[odd[0]] > 1){
				cout << M << endl;
				cout << A[odd[0]] - 1;
				ffg = true;
			}
			else if (A[odd[1]] > 1) {
				cout << M << endl;
			}
			else {
				cout << M - 1 << endl;
			}
			rep(i, 0, M)
			{
				if (odd[0] == i || odd[1] == i) continue;
				if (ffg) cout << " ";
				ffg = true;
				cout << A[i];
			}
			cout << " " << 2;
			if(A[odd[1]] > 1) cout << " " << A[odd[1]] - 1 << endl;
		}
	}
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <iomanip>
using namespace std;
typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<string> VS;
typedef vector< vector<int> > VVI;
typedef vector< vector<ll> > VVL;
typedef pair<int,int> PII;
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(a) (a).begin(),(a).end()
#define pb push_back
#define mp make_pair
#define ub upper_bound
#define lb lower_bound

int main(){
  ll N,M;
  cin>>N>>M;
  VL A(N);
  rep(i,N) cin>>A[i];
  VL X(N+1);
  rep(i,N) (X[i+1]=X[i]+A[i])%=M;
  sort(all(X));
  ll ans=0;
  ll cnt=1;
  rep(i,N){
    if(X[i+1]!=X[i]){
      ans+=cnt*(cnt-1)/2;
      cnt=1;
    }else{
      cnt++;
    }
  }
  ans+=cnt*(cnt-1)/2;
  cout<<ans<<endl;
}

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

#define int long long
#define double long double

#define REP(i, b) for(int i = 0; i < (b); i++)
#define REPS(i, b) for(int i = 1; i <= (b); i++)
#define ALL(v) (v).begin(), (v).end()

#define fi first
#define se second
#define pb push_back
#define mp make_pair

using namespace std;

using pi = pair<int, int>;
using vi = vector<int>;
using vd = vector<double>;
using vs = vector<string>;
using vb = vector<bool>;
using vpi = vector<pi>;
using vvi = vector<vi>;
using vvb = vector<vb>;

const int INF = 1e9;
const int MOD = 1e9+7;

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


signed main()
{
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(10);

    int N, M; cin >> N >> M;
    vi A(M);
    REP(i, M) cin >> A[i];
    int sum = 0; REP(i, M) sum += A[i];
    if(sum > N) cout << -1 << endl;
    else cout << N-sum << endl;
}

Measured memory_bytes: 3728
import queue
import math
import copy
"""
N = int(input())
#S = input()
# (N,M) = (int(i) for i in input().split(" "))
# A = [int(i) for i in input().split()]
A = []
for i in range(N):
	A.append(int(input()))

print(A)

"""
def T(a,b):
	s = a*b
	if a > b:
		b += a
		a = b - a
		b -= a
	while b % a != 0:
		b %= a
		b += a
		a = b - a
		b -= a
	return a

mp = {}

Ans = 0
K = int(input())
for a in range(1,K+1):
	for b in range(1,K+1):
		t = T(a, b)
		if not t in mp:
			one = 0
			for c in range(1,K+1):
				# print(a,b,c,T(t,c))
				one += T(t,c)
			mp[t] = one
		Ans += mp[t]
print(Ans)


Measured memory_bytes: 9820
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

n = int(readline())
s = [readline().decode().rstrip() for _ in range(n)]
"".join(s)
print('AC x',s.count('AC'))
print('WA x', s.count('WA'))
print('TLE x', s.count('TLE'))
print('RE x', s.count('RE'))

Measured memory_bytes: 16496
#include <bits/stdc++.h>
#define rep(i,n)    for(long long i = 0; i < (n) ; ++i)
#define orep(i,n)   for(long long i = 1; i <= (n); ++i)   // one rep
#define drep(i,n)   for(long long i = (n)-1; i >= 0; --i) // down rep
#define srep(i,s,t) for(long long i = (s); i < (t); ++i)  // set rep
#define rng(x)  (x).begin(),(x).end()

  // range
#define rrng(a) (a).rbegin(),(a).rend() // reverse range
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define ru(x,y) (((x)+(y)-1)/(y)) // round up
#define fi first
#define se second
#define eb emplace_back
#define fcout cout << fixed << setprecision(15)


using namespace std;
using ll  = long long;
using P   = pair<int,int>;
using vi  = vector<int>;
using vvi = vector<vi>;
using vp  = vector<P>;
using vl  = vector<ll>;

template<typename T> void Yes(T flag) {
  cout << (flag ? "Yes" : "No") << endl;
}

template<typename T> void pv(vector<T> vec) {
  cout << "[";
  for(auto& v : vec) { cout << v << ","; }
  cout << "]" << endl;
}

template<>
void pv(vector<P> vec) {
  cout << "[";
  for(auto& v : vec) {
    cout << "<" << v.fi << ","<< v.se << ">" << ",";
  }
  cout << "]" << endl;
}

template<typename T> void pv2(vector<vector<T>> vec) {
  for(auto& v : vec) pv(v);
}

int main() {
  int h,n;
  cin >> h >> n;
  int sum=0;
  rep(i,n) {
    int a;
    cin >> a;
    sum+=a;
  }

  Yes(h<=sum);


  return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <array>
#include <vector>
#include <iostream>
#include <fstream>
#include <string>
#include <cmath>
#include <functional>
#include <queue>

//AtCoderC++.cpp

using namespace std;


int main() {
	int A, B, C;
	cin >> A >> B >> C;
	int Max = max(A, max(B, C));
	int Rest = Max * 3 - A - B - C;
	if (Rest % 2 != 0)Rest += 3;
	cout << Rest / 2 << endl;
	return 0;
}

Measured memory_bytes: 256
def main():
    s = input()

    ok_str = ['A', 'T', 'C', 'G']

    count = 0
    tmp = 0

    for i in range(len(s)):
        if s[i] in ok_str:
            tmp += 1
        else:
            if count < tmp:
                count = tmp
            tmp = 0

    if count < tmp:
        count = tmp

    print(count)

if __name__ == '__main__':
    main()

Measured memory_bytes: 38552
# -*- coding: utf-8 -*-

def get_diff(T, A, x):
    temp = T - x * 0.006
    return abs(temp - A)


N = int(input())
T,A = map(int, input().split())
H_list = list(map(int, input().split()))

for i, h in enumerate(H_list):
    if i==0:
        diff_min = get_diff(T, A, h)
        diff_min_idx = i + 1
    else:
        diff = get_diff(T, A, h)
        if diff_min > diff:
            diff_min = diff
            diff_min_idx = i + 1 

print(diff_min_idx)


Measured memory_bytes: 9116
#include <bits/stdc++.h>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<string> vs;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef vector<pll> vpll;
typedef pair<int,P> pip;
typedef vector<pip> vip;
const int inf=1<<30;
const ll INF=1ll<<60;
const double pi=acos(-1);
const double eps=1e-9;
const ll mod=1e9+7;
const int dx[4]={0,1,0,-1},dy[4]={1,0,-1,0};

int n;
string s;
vi a;
vvi g;

int main(){
	cin>>s;
	n=s.size();
	a=vi(n);
	g=vvi(n);
	for(int i=0;i<n;i++) if(s[i]=='1') a[i]++;
	bool B=1;
	for(int i=0;i<n/2;i++) if(a[i]!=a[n-i-2]) B=0;
	if(a[n-1]) B=0;
	if(!a[0]) B=0;
	if(!B){
		cout<<-1<<endl;
		return 0;
	}
	int v=1,S=2;
	g[0].push_back(1);
	for(int i=1;i<n-1;i++) if(a[i]){
		int u=v+1;
		while(S<=i){
			g[v].push_back(u);
			u++;S++;
		}
		g[v].push_back(u);
		S++;
		v=u;
	}
	for(int v=0;v<n;v++) for(auto u:g[v]) cout<<u+1<<' '<<v+1<<endl;
}

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

public class Main
{

    public static void process()throws IOException
    {   
        int a=ni(),b=ni(),c=ni();
        pn(c+" "+a+" "+b);
    }


       static AnotherReader sc;
    static PrintWriter out;
    public static void main(String[]args)throws IOException
    {
        out = new PrintWriter(System.out);
        sc=new AnotherReader();
        boolean oj = true;

        //oj = System.getProperty("ONLINE_JUDGE") != null;
        if(!oj) sc=new AnotherReader(100);

        long s = System.currentTimeMillis();
        int t=1;
        while(t-->0)
            process();
        out.flush();
        if(!oj)
            System.out.println(System.currentTimeMillis()-s+"ms");
        System.out.close();  
    }

    static void pn(Object o){out.println(o);}
    static void p(Object o){out.print(o);}
    static void pni(Object o){out.println(o);System.out.flush();}
    static int ni()throws IOException{return sc.nextInt();}
    static long nl()throws IOException{return sc.nextLong();}
    static double nd()throws IOException{return sc.nextDouble();}
    static String nln()throws IOException{return sc.nextLine();}
    static long gcd(long a, long b)throws IOException{return (b==0)?a:gcd(b,a%b);}
    static int gcd(int a, int b)throws IOException{return (b==0)?a:gcd(b,a%b);}
    static int bit(long n)throws IOException{return (n==0)?0:(1+bit(n&(n-1)));}
    static boolean multipleTC=false;



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

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

Measured memory_bytes: 24532